C# Light Weight Classes, records in C#

C# Light Weight Classes – Records in C#

C# Light weight classes allow creating a class more flexible. It’s beautiful and new way to build your class called as records. Records in c# enable creating POCO type objects very quickly. Records / C# Light Weight Classes also solve the problem of equality comparison of objects.

Creating a C# Light Weight Classes

The below example will help you to understand in implement immutable classes and auto implementation of properties. Person class has a private set property which can be initialized only by a constructor. This example you can see, how to initialize the dynamic object creation using LINQ.

Example