我对这里所需的数据类型感到完全困惑。
我有这个Linq语句:
var feat = AllCustomers
.Select(c => c.CustomerServices.SelectMany(cs => cs.CustomerServiceFeatures)
.SelectMany(csf => csf.ConfigElements).Where(ce => ce.Name == "ItemType").Select(ce => ce.Value).Distinct());
它返回所需的数据,VS 告诉我类型已被设置为:
System.Data.Objects.ObjectQuery<System.Collections.Generic.IEnumerable<string>>
然而,我希望将这些数据添加到一个字符串列表中:
List<string> itemTypes = new List<string>();
itemTypes.AddRange(feat);
但是这会抛出一个错误:
Argument 1: cannot convert from 'System.Linq.IQueryable<System.Collections.Generic.IEnumerable<string>>' to 'System.Collections.Generic.IEnumerable<string>'
我找不到将数据转换为正确类型所需的语法。有人能帮忙吗?
谢谢, Matt