Listnumbers = new List () { 1, 5, 10 }; double average = numbers.Average(); Console.WriteLine(average); Output: 5.333333333333333
ListIn this example, we create an empty List of integers and attempt to calculate the average, which results in an `InvalidOperationException`. The `Average` method is part of the `System.Linq` namespace and is included in the `System.Core` assembly.emptyList = new List (); double average = emptyList.Average(); Output: System.InvalidOperationException: Sequence contains no elements.