소스를 긁어서 복사 붙이기 했더니... 역시나 빨간줄....
Thread 를 사용하려는데 어떻게 하는지 잊었다.
아래와 같은 코드를 사용하려면...
new Thread(new ThreadStart(DoRoutine)).Start(); // 쓰레드 정의
using System.Threading;
를 사용해야 한다.
즉, Thread 를 사용하려면 System.Threading Namespace 를 써야 한다.
빨간줄이 나왔다고 당황하지 말고 써 주자.
System.Threading Namespace에 대한 내용은 아래 링크 참고.
docs.microsoft.com/en-us/dotnet/api/system.threading?view=net-5.0
System.Threading Namespace
Provides classes and interfaces that enable multithreaded programming. In addition to classes for synchronizing thread activities and access to data (Mutex, Monitor, Interlocked, AutoResetEvent, and so on), this namespace includes a ThreadPool class that a
docs.microsoft.com
Provides classes and interfaces that enable multithreaded programming.
이라고 되어 있다.
Thread외에 멀티쓰레드 프로그래밍을 사용하는 인터페이스와 클래스를 제공한다.
Thread Class는 아래 링크 참조.
docs.microsoft.com/en-us/dotnet/api/system.threading.thread?view=net-5.0
Thread Class (System.Threading)
Creates and controls a thread, sets its priority, and gets its status.
docs.microsoft.com
예제 소스도 잘 나와 있으니 참고하자!
'공부 > C#' 카테고리의 다른 글
211026 Visual studio 크기 조정 (0) | 2021.10.26 |
---|---|
210321 Visual Studio C# 도구상자 표시 (1) | 2021.03.22 |
210304 C# Winform 첫 번째 클래스 (0) | 2021.03.15 |
210307 C# 커서위치 제어 프로그램 (0) | 2021.03.07 |
210212 OpenCV C# PictureBoxIpl SizeMode (0) | 2021.02.12 |