11,584 questions
Seems you need a nullable list which in this case returns 10.75
List<int?> list = new List<int?>() {10,null,11,12,10};
Console.WriteLine(list.Average());
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How to get the average of a list that contains null value?
Seems you need a nullable list which in this case returns 10.75
List<int?> list = new List<int?>() {10,null,11,12,10};
Console.WriteLine(list.Average());