以下内容目前正在运行,但我需要应用我未能实现的 WHERE 子句。当前代码如下所示。我的尝试显示在当前代码行的正下方。编译器抱怨“无法将表达式类型 IEnumerablestring, double> 转换为返回类型 'bool'”。有什么建议么!?非常感谢,
工作代码
return new GroupedDataCollection(data.SummaryValuations.Select(d => new GroupedData(d)));
试图
return new GroupedDataCollection(data.SummaryValuations.Where(x => x.Values.Where(y => y.Value.ContainsKey(filter))).Select(d => new GroupedData(d)));
底层结构
public class GroupedData
{
private SummaryValuation valuation;
public GroupedData(SummaryValuation valuation)
{
this.valuation = valuation;
}
}
public class SummaryValuationGroup
{
public string Grouping { get; set; }
public SummaryValuation[] SummaryValuations { get; set; }
}
public class SummaryValuation : ISummaryValuation
{
public SummaryValuation(DateTime valuationDate, SummaryGroup[] groups, Dictionary<string,Dictionary<string,double>> stuff)
{
....
}
}