I want to implement some properties that can be set only one time. I am aware of readonly but i want to be able to set the value from outside the class.
The situation is the following: I have a class which i use as a key for some data i read from database. This key-class contains several properties.
My first idea was to make multiple constructors where i can set the properties like i need them but since "not set" is a valid state for most of these properties i soon had a bunch of constructors and i decided this is not the best way.
I can't make the properties with public setters because they are key information and it's no good to change them afterwards. So i need a way to set them once from outside the key-class because i don't want to make 20 slightly diffrent constructors for every case.
Is there some readonly-like easy to go method to do this or will i have to implement it myself?