티스토리 뷰
C# 2.0 에서는 ThreadStart delegate를 사용하지 않아도 된다.
아래 예제를 보자.
아래 예제는 앞 예제와 같은 것이다.
하지만 ThreadStart delegate를 사용하지 않았다.
아래 예제를 보자.
아래 예제는 앞 예제와 같은 것이다.
하지만 ThreadStart delegate를 사용하지 않았다.
using System;
using System.Threading;
namespace ThreadSample
{
class Program
{
public const int Repetitions = 1000;
static void Main(string[] args)
{
Thread myThread = new Thread(DoWork);
myThread.Start();
for (int count = 0; count < Repetitions; count++)
{
Console.Write('-');
}
myThread.Join();
}
public static void DoWork()
{
for (int count = 0; count < Repetitions; count++)
{
Console.Write('.');
}
}
}
}
using System.Threading;
namespace ThreadSample
{
class Program
{
public const int Repetitions = 1000;
static void Main(string[] args)
{
Thread myThread = new Thread(DoWork);
myThread.Start();
for (int count = 0; count < Repetitions; count++)
{
Console.Write('-');
}
myThread.Join();
}
public static void DoWork()
{
for (int count = 0; count < Repetitions; count++)
{
Console.Write('.');
}
}
}
}
'Code > C#' 카테고리의 다른 글
| Thread & Lock 사용법과 예제 (0) | 2007.12.08 |
|---|---|
| Thread & Monitor 사용 방법과 예제 (0) | 2007.12.08 |
| [C#] Thread 샘플 코드 4 (0) | 2007.12.08 |
| [C#] Thread & FileStream 사용 예제 (0) | 2007.12.07 |
| [C#] Thread 샘플 코드 3 (0) | 2007.12.07 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- WinAutomation
- tagREADYSTATE
- 애드센스숨기기
- AxWebBrowser
- READYSTATE_COMPLETE
- AdSense숨기기
- 스크린캡쳐
- windows
- iTextSharp
- Microsoft
- 유틸리티
- .net framework
- DotNetMagic
- AdSense감추기
- Regular Expressions
- Sample Code
- ScreenHunter
- autohotkey
- java
- download.com
- Automation
- iText
- 애드센스감추기
- jre
- Phalanger
- c#
- Rollback Rx
- Service pack
- registry
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
글 보관함