안정성1 [C#][Study][기초다지기] 제네릭 Generic 제네릭 - 코드 type 안전성, 성능 및 코드 유용성을 향상시킴 - 대부분 Generic은 컬렉션 클래스를 생성하는데 사용됨(List, Vector 등) - System.Collections.Generic 네임스페이스를 추가해 제네릭을 사용할 수 있음 - 자신만의 코드를 만들 수 있음 1) 선언 public class GenericList { void Add(T input) { } } 2) 사용 class TestGenericList { private class ExampleClass { } static void Main() { // int형 리스트 GenericList list1 = new GenericList(); // string형 리스트 GenericList list2 = new GenericL.. 2023. 9. 23. 이전 1 다음