Everything You Want to Know About the Record Type in .NET: Performance

DotNetDave shared a great article about the performance working with Records in .Net #mustRead

dotNetTips.com

In my article titled Everything You Want to Know About the Record Type in .NET 5… But Were Afraid to Ask that I wrote in early 2021, I introduced readers to the new record type introduced in .NET 5 and why, as a class author, I like it. In this article, I will drill down into the performance using the record type.

For all the examples in this article, the record I am using for comparison is PersonRecord and the Person (POCO) class in my OSS assembly that I use for testing. Both have the same properties and data validation.

Creating a Record Type in Memory

First, let us look at the performance difference creating a normal Person object compared to a PersonRecord object. Depending on if you are using .NET 5 or 6, overall, Person is more performant. But, in .NET 6, the speed is much better.

View original post 634 more words

1 comment

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.