Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- unity animation
- typeof
- Default
- 오블완
- c
- VRChat
- generic
- CS
- fusion
- unityai
- 제네릭
- navmash
- Animation
- unity mixamo
- c#
- pothon
- booth
- animator
- 포톤
- mixamo
- 티스토리챌린지
- 유니티
- navmashagent
- unity
- 유니티 네비매쉬
- 브이알챗
- sendcustomnetworkevent
- udon#
- u#
Archives
- Today
- Total
대마법사의 개발 블로그랄까?
C# Generic 제네릭이란 무엇인가? 본문
C#은 제네릭이라는 아주 유용한 기능이 있다.
보통 List<t>나 Dictionary<t1,t2>에서 많이 접해봤을 것이다.
제네릭의 활용도
- 컬렉션
- 델리게이트
- 비동기 코드 Task<T>
제네릭이 될 수 없는 것
- 필드(filed)
- 속성(property)
- 인덱서(indexer)
- 생성자(constructor)
- 이벤트(event)
- 종료자(finalizer)
Type Parameter : 타입 매개변수
Arity : 타입 매개변수의 개수
- `Arity` 가 다르면 오버로드가 가능하다.
- 타입 매개변수의 이름 변경만으로 오버로드 되지않는다.
- Arity가 2인 경우 타입 매개변수의 이름은 서로 달라야 한다.
private void List<T> Test(){}
//T is Type parameter
private void List<T1,T2> Test(){}
private void List<Ta,Tb> Test(){} //컴파일 에러
private void List<T1,T2,T3> Test(){} // 가능
private void List<T1,T1> Test(){} // //컴파일 에러
'너 C# 완벽해? > 책읽고 작성하기' 카테고리의 다른 글
C# Default 와 Typeof() (0) | 2025.01.15 |
---|