.NET Framework 3.5 발표와 함께 C# 3.0에 새로 추가된 것 중에 Extension Methods란 것이 있다. Extension Methods는 기존에 존재하는 Type에 Method를 추가할 수 있게 해주는 것이다. Extension Methods가 나오기 전에는, 이미 존재하는 Class에 새로운 Method를 추가하려면 상속 클래스를 만들어야했다. 하지만 Extension Methods를 사용하면 상속 클래스를 만들지 않고도 Method를 추가할 수 있는 것이다. 아래 예를 보자.
난수를 발생할 때, 중복되지 않는 것들로만 해야할 때가 있다. 이와 같은 경우에 사용할 수 있는 예제를 하나 만들어 보았다. List Generic Collection을 사용해서 만들었다. using System; using System.Collections.Generic; namespace RandomNumber { class Program { static void Main(string[] args) { Random myRandom = new Random(); List myList = new List(); int r; for (int i = 0; i < 3; i++) { do { r = myRandom.Next(5); } while (myList.Contains(r)); myList.Add(r); } ..
Jagged Array는 Multidimensional Array와는 다르므로 주의를 요합니다. 아래는 Jagged Array 선언 방법을 보여주는 샘플 코드입니다. Multidimensional Array와 헷갈리지 않도록 앞에 있는 Multidimensional Array 선언 방법과 비교해가며 보시기 바랍니다. namespace ArraySample { class Program { static void Main(string[] args) { // Jagged Array int[][] zArray; zArray = new int[3][]; zArray[0] = new int[] { 1, 2, 3 }; zArray[1] = new int[] { 1, 2 }; zArray[2] = new int[] { ..
- Total
- Today
- Yesterday
- AdSense감추기
- iText
- download.com
- tagREADYSTATE
- 유틸리티
- .net framework
- READYSTATE_COMPLETE
- AxWebBrowser
- AdSense숨기기
- Phalanger
- c#
- ScreenHunter
- Rollback Rx
- registry
- iTextSharp
- windows
- WinAutomation
- 애드센스감추기
- 애드센스숨기기
- Automation
- Sample Code
- DotNetMagic
- autohotkey
- Regular Expressions
- java
- 스크린캡쳐
- Service pack
- jre
- Microsoft
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |