Linq表达式树

时间:2015-07-03 08:40:41

标签: linq expression-trees

我想生成像

这样的表达式树
StatusRAG.where(x=> (overallRAG.Contains(x.OverallRAG) == overallRAGinclusive) || (costRAG.Contains(x.CostRAG) == costRAGinclusive))

这是我的数据:

var overallRAG  = new  List<string>(){"Red", "Green"}
var costRAG  = new  List<string>(){"Red", "Amber"}
bool overallRAGinclusive = true
bool costRAGinclusive = false
class StatusRAG
{
    public OverallRAG {get; set;}
    public CostRAG {get; set;}
}

1 个答案:

答案 0 :(得分:0)

Linq表达错误。我认为你不必等于costrag。

StatusRAG.where (x=> overallRAG.Contains(x.OverallRAG) || !costRAG.Contains(x.CostRAG))