我想獲得一個獨特的,按字母順序排列的行業名稱(字符串)列表。這裏是我的代碼:列表排序編譯錯誤
HashSet<string> industryHash = new HashSet<string>();
List<string> industryList = new List<string>();
List<string> orderedIndustries = new List<string>();
// add a few items to industryHash
industryList = industryHash.ToList<string>();
orderedIndustries = industryList.Sort(); //throws compilation error
最後一行拋出一個編譯錯誤: 「無法隱式轉換類型‘無效’到「System.Collections.Generic.List」
我在做什麼錯?
當你在這,你可能也使用OrderedSet BTW。 http://msdn.microsoft.com/en-us/library/dd412070.aspx – C4stor