我想要做的是將字符串轉換爲使用linq的字符串列表。我嘗試下面的代碼行:將字符串轉換爲列表<string>
value = "one,two,three,four";
List<string> arr = value.Split(',').Select(s => s.ToList());
但我得到的錯誤:
錯誤1無法隱式轉換類型「System.Collections.Generic.IEnumerable>」到「System.Collections.Generic .LIST」。一個顯式轉換存在(是否缺少強制轉換?)
如果有人可以提供一些幫助,這將是真棒。
可能重複:http://stackoverflow.com/questions/5011467/convert-string-to-liststring-in-one-line – reggie 2012-07-31 13:39:41