在C#中,是什么使字段与属性不同,何时应该使用字段而不是属性?
c# field properties
在C#6.0中我可以写:
public int Prop => 777;
但我想使用getter和setter.有办法做下一件事吗?
public int Prop { get => propVar; set => propVar = value; }
c# c#-6.0
c# ×2
c#-6.0 ×1
field ×1
properties ×1