Is there a way to initialize constant values in c# at runtime like with initialization lists in c++-ctors?
Specifically, I want to make sure that a specific value (the port used) is not changed after the main class was created. Maybe there’s another way to do this.
You can use the
readonlykeyword:Example (copied from the linked MSDN page):