【发布时间】:2013-04-12 12:29:32
【问题描述】:
我有所有 ID 的列表。
//代码
List<IAddress> AllIDs = new List<IAddress>();
AllIDs= AllIDs.Where(s => s.AddressId.Length >= s.AddressId.IndexOf("_"))
.Select(s => s.AddressId.Substring(s.AddressId.IndexOf("_")))
.ToList();
我正在使用上述 LINQ 查询,但出现编译错误:
//错误
无法隐式转换类型 System.Collections.Generic.List 到 System.Collections.Generic.List
我想根据字符“_”对成员字段AddressId 进行子串操作。
我哪里错了?
【问题讨论】:
-
您正在尝试将
List<string>分配给List<IAddress>...