... | @@ -21,6 +21,7 @@ |
... | @@ -21,6 +21,7 @@ |
|
* [4-3. System.Collections.SortedList](#sortedlist)
|
|
* [4-3. System.Collections.SortedList](#sortedlist)
|
|
* [4-4. System.Collections.Stack](#stack)
|
|
* [4-4. System.Collections.Stack](#stack)
|
|
* [4-5. System.Collections.Queue](#queue)
|
|
* [4-5. System.Collections.Queue](#queue)
|
|
|
|
* [4-6. 제네릭](#제네릭)
|
|
* [5. 파일](#파일)
|
|
* [5. 파일](#파일)
|
|
* [5-1. System.IO.FileStream](#filestream)
|
|
* [5-1. System.IO.FileStream](#filestream)
|
|
* [5-2. System.IO.File/FileInfo](#filefileinfo)
|
|
* [5-2. System.IO.File/FileInfo](#filefileinfo)
|
... | @@ -917,6 +918,23 @@ class QueueEx |
... | @@ -917,6 +918,23 @@ class QueueEx |
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
|
|
### 제네릭
|
|
|
|
ArrayList의 박싱/언박싱 문제를 해결하기 위해서는 ArrayList가 다루는 데이터 타입을 고정시켜야 한다. 하지만 타입 별로 코드를 각각 다르게 구현해야 하는 문제점이 발생하는데, 이를 해결해주는 것이 제네릭이다.
|
|
|
|
|
|
|
|
컴파일 시 Type Parameter 정보를 갖는 IL과 메타데이터를 생성하고. IL을 JIT 컴파일 할 때 Type Parameter를 실제 타입으로 대체한다.
|
|
|
|
|
|
|
|
기본 사용법은 다음과 같다.
|
|
|
|
|
|
|
|
```c#
|
|
|
|
int n = 5;
|
|
|
|
List<int> list = new List<int>();
|
|
|
|
list.Add(n); //박싱 과정 없이 바로 넣는다.
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 파일
|
|
## 파일
|
|
### FileStream
|
|
### FileStream
|
|
FileMode
|
|
FileMode
|
... | | ... | |