LINQ has also gotten some attention during the development of .NET 6. Multiple new extensions have been added. Among these additions are: Support for indices and ranges when using
IEnumerablecollections, adding key selector variants for many of the existing LINQ extensions so that you can use e.g.
DistinctBy, adding overloads to the extensions with defaults like
FirstOrDefaultso that you can decide the default, and a couple of other minor additions. We will go through these additions to LINQ in this article and benchmark some of them against previous approaches.