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. class Person { // create class members that are read only private readonly string _firstname; private readonly string _lastname; // […]