Setting up our in-memory sample data
You will be studying LINQ performance, therefore, you are going to need a collection to work with. You will work with a collection of Person
objects. Each person will be named from the Greek alphabet. A Person
object will consist of a FirstName
, LastName
, and FullName
property. The FullName
property will be an interpolated string that combines the first and last name of the person.
Let us now begin coding our LINQ coding combined with benchmarking, so that we can measure the performance of our LINQ statements:
- Create a new .NET 6.0 console application called
CH07_LinqPerformance
. - Install the NuGet package
BenchmarkDotNet
. - Add the following
Person
struct:public struct Person { public string FirstName { get; set; } public string LastName { get; set; } public string FullName { get { return &...