
[C#] Dictionary란
·
언어/C#
Dictionary란 Key값과 Value를 사용해 값들을 지정해놓을 수 있는 유용한 클래스를 말한다. 정말 사전처럼 미리 지정해놓은 Key값에 해당하는 Value를 손쉽게 찾아볼 수 있다. Key값은 중복되어서는 안된다. using System; namespace ConsoleApp1 { class Program { static void Main(string[] args) { Dictionary dic = new Dictionary(); // Dictionary 이름 = new Dictionary(); dic.Add(3, "봄"); dic.Add(1, "겨울"); dic.Add(10, "가을"); dic.Add(8, "여름"); foreach(KeyValuePair n in dic) Console.Wr..