C# ICollection
![[C#] Collection과 Interface](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FcQLeMx%2FbtqDHr7Kd0r%2FAAAAAAAAAAAAAAAAAAAAAJbQI6pQxc6c9qypr1gz8rxO5k09YnmgJbUozIDgBmiP%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1756652399%26allow_ip%3D%26allow_referer%3D%26signature%3DQet1tye1gG7ZlT5odgFN7EYv%252BlY%253D)
[C#] Collection과 Interface
1. 핵심 정리 using System; using System.Collections.Generic; clss Program { static void Main() { List c1 = new List(); c1.Add(10); c1.Add(20); c1.Clear(); int n = c1[0]; // IList에 있는 메소드(인덱서) SortedSet c2 = new SortedSet(); c2.Add(10); c2.Add(20); c2.Clear(); int n2 = c2[0]; // error } } 위의 코드에서 List는 동적배열이고 SortedSet은 트리구조이다. 분명 내부적으로 데이터를 다루는 코드는 다를텐데 요소를 추가하는 메소드는 Add로 같다. 또한 모든 요소를 지우는 Clear메소드도..