我试图总结花车的列表,内置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