C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,843 questions
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());