DICTIONARY (1) 썸네일형 리스트형 Using custom class as C# Dictionary key type 요약 : 직접 만든 클래스를 Dictionary의 key로 사용하고 싶을 경우 추가적으로 해야 할 작업을 알아본다. 1. 아래와 같이 Point class를 만들고 좌표가 같을 경우 같은 Point로 인식하게 하고 싶다. public class Point { public Point(int x, int y) { X = x; Y = y; } public int X { get; set; } public int Y { get; set; } } 현재 상태에서 좌표가 같은 두 Point를 Dictionary에 Add()하면 예외 없이 정상적으로 추가된다. var p1 = new Point(0, 0); var p2 = new Point(0, 0); var points = new Dictionary(); points... 이전 1 다음