In the case where you only set a variable at the initialization of an object, but want other objects to be able to read the variable and not set it after initialization, what would be the correct syntax in C#?
From what I understood it would look something like this:
class Test
{
private string name;
public string Name { get { return name; } }
public Test() {
this.name = "Hello World!";
}
}
Is this the correct way?