While GroupBy took a single collection and transformed it into multiple child collections, SelectMany flattens child collections into a single merged collection.
LINQ GroupBy in Depth
Let’s talk about how LINQ’s GroupBy method makes grouping data in C# easy. We’ll start basic and then go over every available overload of the GroupBy method to explore advanced use cases.
Using Extension Methods in C# to Build Fluent Code
Extension methods are an integral part of modern .NET and some of .NET’s best features such as LINQ. Unfortunately, a lot of developers get intimidated by them.