There are many ways to return one element from a list using a LINQ query in C#.
Why are there so many, and what are the differences between each one? We get to the bottom of it in this video by setting up a list and testing each one and going through a number of different examples and testing the output in a console application.
In-addition, we'll set up some benchmarking to see which one performs the best and how much memory is allocated for each one.
📖 Learn .NET and C# with our online courses 📖
https://www.roundthecode.com/dotnet-c...
👨💻Take our .NET and C# coding challenges👨💻
https://www.roundthecode.com/dotnet-c...
► More information:
https://www.roundthecode.com/dotnet-b...
► Chapters
0:00 What we'll cover
0:11 Setting up the list
0:23 First and FirstOrDefault
1:17 Single and SingleOrDefault
2:18 Benchmarking
3:42 Test your C# knowledge with coding challenges
#linq #linquery #csharp