Immutable types in C# with Roslyn

14 mar 2020 | Blog | .net | c# | roslyn | IT
Some time ago I came across Jimmy Bogard’s article “Immutability in DTOs?" about the pros and cons of using immutable type pattern/approach. I fully agree with the author - the idea of immutable types is great but without the proper support from the language syntax it might not be worth applying. C# allows creating immutable types by adding readonly keyword to fields or by removing setter from properties. We are obligated then to initialize those readonly members from the constructor or directly in the member’s definition.

POSTY TEGO AUTORA

Visualizing Test Execution with OpenTelemetry4 maj 2025

Blog | programowanie | .net | c# | IT

Structuring Test Projects for Maintainability1 maj 2025

Blog | programowanie | testowanie | software design | IT

How to Run a React Development Server with HTTPS4 sty 2025

Blog | programowanie | .net | react | IT

Mocking authorization tokens with WireMock.NET28 lut 2024

Blog | programowanie | .net | c# | IT

C# code snippets for Resharper and Rider9 lut 2024

Blog | programowanie | .net | c# | IT

Cezary Piątek Blog

Cezary Piątek