2018. 8. 2. 13:33
Computer/App.
enum에서 Description 사용
enum 정의- public enum RES
- {
- [Description("0000")]
- SUC,
- [Description("")]
- ETC
- }
- private string _res01;
- public string Res01
- {
- get
- {
- return _res01;
- }
- set
- {
- _res01 = value;
- var type = typeof(RES);
- var memInfoSUC = type.GetMember(RES.SUC.ToString());
- var attributesSUC = memInfoSUC[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
- var descriptionSUC = ((DescriptionAttribute)attributesSUC[0]).Description;
- if (_res01 == descriptionSUC)
- {
- // Description 일치.
- }
- }
- }
'Computer > App.' 카테고리의 다른 글
[C#] Number validation check of textbox (0) | 2018.08.02 |
---|---|
[C#] System.ComponentModel.Win32Exception 에러 처리 (3) | 2016.02.05 |
영상재생중 "apphangb1" 에러 이벤트 (1) | 2015.11.21 |
[WPF] 큰 사이즈의 이미지 바인딩 issue (0) | 2015.11.21 |
ClickOnce 설치 경로 (0) | 2015.09.19 |