[C#/General] 변수 속성구분 (field, property, property get/set/init, property getter/setter)


[C#/General] 변수 속성구분 (field, property, property get/set/init, property getter/setter)

> field 선언 public class Codekiller { // field 선언. public string CodeKillerName; } > Get/Set 접근자에 의한 선언 public class CodeKiller { // property get/set 선언 public string CodeKillerName { get; set; } // 초기화 public string CodeKillerName { get; set; } = string.Empty; } > 읽기전용 속성을 이용한 선언 public class CodeKiller { public string CodeKillerName { get { return _codeKillerName; } set { _codeKillerName = valu..


원문링크 : [C#/General] 변수 속성구분 (field, property, property get/set/init, property getter/setter)