c# - How to get the sum of list of shorts using the extension method Sum()? -
I was trying to do something like this -
list & lt; Short> Listofshorts = New list & lt; Short> (); Int s = listofshorts.Sum (); // This does not work ... but works for the same code ints list.
I found this compilation error -
< P> Can someone suggest how can I use an extension method to calculate the sum of shorts? The extension method does not support it for some reasons ...'System Collections. There is no definition for 'yoga' in Generic.List and there is some invalid argument in the best extension method overload 'System.Linq.Queryable.Sum (System.Linq.IQueryable)'.
int s = listofshorts sum ( D = & gt; D);
Comments
Post a Comment