What is the difference between a property with a omitted setter and a property with a private setter?
public string Foo { get; private set; }
vs
public string Foo { get; }
In C# 6, get; only properties are only settable from the constructor. From everywhere else, it is read-only.
get;
A property with a private set; can be set from everywhere inside that class.
private set;
1.4m articles
1.4m replys
5 comments
57.0k users