반응형
Dictionary<string,int> dic = new Dictionary<string, int>();
dic.Add("key1", 1);
dic.Add("key2", 2);
dic.Add("key3", 3);
foreach(KeyValuePair<string, int> kv in dic)
{
Console.WriteLine("Key: {0}, Value: {1}", kv.Key, kv.Value);
}
아이가릿
저 자리에 Dictionary<string,int> 이딴거 안되고 KeyValuePair 이것만 댐
매우 간단하지만 모르면 짲응나는 것
출처 : http://kuros-textcube.blogspot.kr/2009/03/dictionary-foreach-%EB%A3%A8%ED%94%84-%EB%8F%8C%EB%A6%AC%EA%B8%B0.html
반응형
'▩▩ 프로그래밍 ▩▩ > C#' 카테고리의 다른 글
| [C#] DataGridView 마우스 우클릭 메뉴 (0) | 2013.09.26 |
|---|---|
| [C#] DataGridView 에서 마지막 행 남아있는 거 없애기 (4) | 2013.09.26 |
| [C#] byte[] -> hex (0) | 2013.09.05 |
| [C#] 색깔있는 커스텀 마우스 커서 (0) | 2013.08.26 |
| [C#] Async / await (0) | 2013.07.04 |
| [C#] 파일 입출력 / 바이너리 파일 저장 (0) | 2013.07.04 |
| [C#] 바탕화면 바꾸기 (2) | 2013.06.26 |
| [C#] 비주얼 스튜디오 2012 리소스(Resource) 파일 등록 (0) | 2013.06.26 |
![[나크21] 캐주얼 미니스커트 치마바지 NK21-P-10](https://image13.coupangcdn.com/image/affiliate/banner/a0874210c3b8ced08e8de1985ebfb8c9@2x.jpg)

