3 ms·
C# Light Syntax
- DanielStraight 15y agoAuto-properties can be public read, private set. So really, it looks like: namespace MyCompany.MyProduct { public class Person { public Person(string name, int age) { Name = name; Age = age; } public string Name { get; private set; } public int Age { get; private set; } } } I suppose it's not technically immutable, but you can just refrain from setting anywhere else inside the class.
- balakk 15y agoThe author responds to that point in the blog's comments section.