In Chapter 6, Implementing Interfaces and Inheriting Classes, you learned how to create your own extension methods. To create LINQ extension methods, all you must do is extend the IEnumerable<T> type.
In either Visual Studio 2017 or Visual Studio Code, open the LinqWithEFCore project or folder, and add a new class file named MyLINQExtensions.cs.
We will look at the Average extension method as an example. Any school child will tell you that average can mean one of three things:
- Mean: Sum the numbers and divide by the count
- Mode: The most common number