C# 對get和set的理解

使用 get set和不使用的對比 比如,有兩個類person: //第一種方式 public class person { public string name; } //第二種方式 public class person { public string Name { set; get; } } 第一個類型的name屬性未封裝,其name屬性直接通過public關鍵
相關文章
相關標籤/搜索