c# 썸네일형 리스트형 [C#] readonly 와 const의 차이점. readonly(C# 참조)위에 링크는 Microsoft 공식 문서글이다. 읽고 정리하고자 적는다. Static 여부 초기화 코드 readonly 기본 Static 필드 선언 시에서만 1private const int test = 100;csconst 앞에 Static 을 써줘야함 필드 선언 or 생성자 1234567891011private readonly int test; public TestClass(){ test = 10;} public TestClass(int value){ test = value;}cs readonly 은 확장성을 가진 const 라고 보면 된다. 하지만 switch case 문에서 readonly string 을 허용하지 않는다고 한다. (2016.10.31일자 기준) 더보기 이전 1 다음