Easier Immutable Objects in C# 6 and VB 12

added by Paul Wheeler
8/25/2014 12:48:26 PM

2 Kicks, 109 Views

A common pain point in .NET programming is the amount of boilerplate code necessary to implement immutable objects. Unlike a normal class, and immutable class requires that each property have an explicitly defined backing store. And of course a constructor is needed to tie everything together. Under a new draft specification, C# and VB will be adding what they are calling a “record class”. This is essentially an immutable class defined solely by its constructor.