Hello, I'm trying to understand the best way to define a class that holds collection of some data that is completely immutable, yet serializable and deserilazable by System.Text.Json. For instance, I want this class to just represent a JSON document from the front-end application, it can be seen as a form of DTO as some sort. However, after spending 30 minutes online and asking ChatGPT, I feel like I still don't have a clear guide on how to construct a class with collections.
I have tried multiple things in my experience with C#.
Backing fields.
Just making them mutable and ignoring the warnings.
Some combination of the previous two???
Please help.
Thanks,
Maguire