Level 4 — Classes
Write modifiers
Original notes by SunDiaL · View English source
Fields can be altered a bit using the following keywords:
readonly-> can have its value set only in the constructor. Trying to change its value outside of a constructor will cause a compiler errorconst-> replaced at compile time with their valuesvolatile-> indicates that a field might be modified by multiple threads that are executing at the same time
Never used
volatilein my life so here's the official docs: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/volatile