我從下面的代碼片段獲得這個 Unable to cast object of type 'System.Int64' to type 'System.String'.
列表獲取一個字符串數組:LINQ Bug?從長期
IList<long> Ids = new List<long>();
Ids.Add(6962056);
Ids.Add(7117210);
Ids.Add(13489241);
var stringIds = Ids.Cast<string>().ToArray();
和Booooooooooooom ....想法?
所以,你必須選擇/轉換的源值...我想CAST()是一次聰明得多的字符串是目標類型,它應該簡單地在源類型上自行調用.ToString()。 – 2009-12-01 09:00:41