我試圖總結花車的列表,內置Sum()
功能,但我不斷收到此錯誤的定義:「System.Collections.Generic.List <float>」不包含「點心」
錯誤CS1061:'System.Collections.Generic.List'不包含'Sum'的定義並且沒有擴展方法'Sum'接受 類型'System.Collections.Generic.List' 的第一個參數可以被找到(是你錯過了使用指令或裝配 參考?)(CS1061)
,我有
using System.Collections;
using System.Collections.Generic;
在文件的開頭:
代碼:
List<float> x = new List<float>();
x.add(5.0f);
//..
float f = x.Sum();
我爲什麼會得到 - 對於這個問題? – Patryk