The 1.readonly modifier is used only to decorate a data member of a class. As the name says, once they have been written, directly initialized, or assigned in a constructor, the data member can only read it.
The difference between a readonly and a const data member is that const requires you to initialize it directly at the time of declaration.
classMyClass {Const intConstint = -;//Proceed directly ReadOnly intMyInt =5;//Proceed directly ReadOnly intMyInt2; PublicMyClass () {MyInt2=8;//the indirect } PublicFunc () {myInt=7;//illegalConsole.WriteLine (myint2.tostring ()); } }
2.sealed
A class with the sealed modifier does not allow you to inherit any class from it
3.unsafe
You can use the unsafe modifier to define an unsafe context in C #. In an unsafe context, you can insert unsafe code, such as pointers to C + +, etc.
C # differs from Java on modifiers