I am trying to Sum a list of floats with built in Sum()
function but I keep getting this error :
Error CS1061: 'System.Collections.Generic.List' does not contain a definition for 'Sum' and no extension method 'Sum' accepting a first argument of type 'System.Collections.Generic.List' could be found (are you missing a using directive or an assembly reference?) (CS1061)
and I have
using System.Collections;
using System.Collections.Generic;
in the beginning of the file:
code :
List<float> x = new List<float>();
x.add(5.0f);
//..
float f = x.Sum();