Runar Ovesen Hjerpbakk

Programmer. Software Architect. Technical Manager.

Functional ... C#? →

The door to my first post of this year’s Bekk Christmas has finally been opened. My article, Functional … C#?, tells the story of immutability in the C# language and gives a quick introduction C# 9’s new, life-saving feature: records!

A record is immutable in that none of the properties can be modified once it’s been created, and the with keyword will help with creating new objects where some of the values should change:

public record Person(uint Age);

var me = new Person(37);
Person meAYearOlder = me with { Age = 38 };

So listen to the meme-advice, stay immutable, STAY SAFE.