我对使用C#的Linq查询非常陌生。我有一个字符串列表,并希望获取一个新的列表或删除所有重复的字符串。
List<string> zipcodes = new List<string>();
zipcodes.Add("1234");
zipcodes.Add("1234");
zipcodes.Add("1234");
zipcodes.Add("4321");
zipcodes.Add("4321");
List<string> groupbyzipcodes =
(from zip in zipcodes
group zip by zip into newgroup
select newgroup.ToList());
无法隐式转换类型
'System.collection.Generic.IEnumarable<System.Collections.Generic.List<string>'
到'System.collections.Generic.List<string>
。存在显式转换(是否缺少强制转换?)