using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace DictionaryExample{ class Program {static void Main(string[] args)
{Dictionary<string, int> d = new Dictionary<string, int>();
d.Add("cat", 2); d.Add("dog", 1); d.Add("llama", 0); d.Add("iguana", -1);Console.WriteLine(d.Count);
Console.WriteLine(d["cat"]);foreach (KeyValuePair<string, int> kvp in d)
{ Console.WriteLine("Key: " + kvp.Key); Console.WriteLine("Value: " + kvp.Value);}
}
}
}
참고 : http://dotnetperls.com/dictionary-keys
'Programming > C#/Xna/Kinect/WPF' 카테고리의 다른 글
| [C#] 컴파일러와 dll파일 (0) | 2012.11.20 |
|---|---|
| [C#] ListView에서 Tag의 활용 (0) | 2012.11.15 |
| [C#] Cross Thread 처리방법 (0) | 2012.11.12 |
| [XNA] Framework의 기본 Logic흐름도 (0) | 2012.10.23 |
| [Luainterface] C#에서 루아 사용하기 (0) | 2012.10.17 |