我想生成像
这样的表达式树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;}
}
答案 0 :(得分:0)
Linq表达错误。我认为你不必等于costrag。
StatusRAG.where (x=> overallRAG.Contains(x.OverallRAG) || !costRAG.Contains(x.CostRAG))