EDIT : I had tried these two ways before -如何將字符串列表轉換爲雙精度?
List<double> doubleList =
stringList.ConvertAll(x => (double)x);
List<double> doubleList =
stringList.Select(x =>
(double)x).ToList();
,並得到這個錯誤:
Cannot convert type 'string' to'double'
我讀到有關整數轉換成雙打東西similiar ...但我有一個字符串列表,我需要轉換爲雙打和列表ConvertAll()不會使用Select擴展方法。任何人都可以請幫助我。
「的ConvertAll()不工作既沒有選擇擴展方法」 - 有什麼錯?編譯器錯誤?例外?還有別的嗎?你能提供代碼嗎? – 2010-07-29 17:49:52
誰投這個問題? – Nix 2010-07-29 17:51:27
我得到錯誤 - 無法轉換類型「字符串」到「雙」,但馬克的回答的作品! – Vishal 2010-07-29 17:51:44