Read-only member and constructor initialization in C#

Read-only member in C#

There are times when we want to create a Person object with firstname and lastname and then ensure that the names are not changeable. Here’s one way of creating read-only member.

read-only member in C#

Read only member are not changeable by class methods. Only the constructor can change it. The member truly becomes read only after the construction finishes.