readonly
is used to make a property as read-only. Read-only members can be accessed outside the class, but their value cannot be changed. Since read-only members cannot be changed outside the class, they either need to be initialized at declaration or initialized inside the class constructor. Employee
class with two properties- empName
and empCode
. Since empCode
Serial jepang semi. is read only, it can be initialized at the time of declaration or in the constructor. empCode
after the object has been initialized, the compiler shows the following compilation error:empCode
Kmd 540 installation manual. is readonly, so we can assign a value at the time of creating an object but not after wards.Readonly<T>
Stargate wraith hive ship. to create a readonly type, as shown below.emp1
is declared as Readonly<IEmployee>
and so values cannot be changed once initialized.