<分区> 分区>
初学者提问:下面的方案有什么缺点吗?
public string SomeProperty { get; private set; }
如 C# public variable as writeable inside the class but readonly outside the class
因为我绝对觉得它比:
string someProperty;
public string SomeProperty{
get {
return someProperty;
}
}
但是为什么C#不能有类似的东西
GetOnly string someProperty;
哪个会和上面的一样?这不是更容易读写吗?
