C#/Winform
(.NET) Dictionary 의 키를 대소문자 구분없이 넣어 찾아 내기
kjun.kr
2017. 4. 15. 14:48
728x90
// 비교연산자중 대소문자를 무시하는 연산자를 선택하고
var comparer = StringComparer.OrdinalIgnoreCase;
// Dictionary 선언시에 연산자를 넣어주면 끝.
Dictionary<String, int> dict = new Dictionary<String, int>(comparer);
dict["TEST"] = 10; //대문자로 넣었지만
int testint = dict["test"];// 소문자로 찾을수 있다 결과는 10
728x90