[c#] system.windows.forms.timer, system.timers.timer, system.threading.timer 비교

.네트에는 세 개의 타이머들이 있다.

system.windows.forms.timer는 디자인 모드에서 툴박스로부터 끌어다 쓸 수 있다. 제일 흔하게 이용된다. 매인 뜨레드에서 작동하므로 비주얼 객체들을 제어할 때 편하다. 하지만 매인 뜨레드에 부하를 더한다.

system.timers.timer는 멀티뜨레드로 작동한다. 비주얼 객체들을 바로 제어하려 하면 크로쓰-뜨레드 예외로 처리된다. 이런 문제를 피하려면 invoke를 이용해야 한다. 비주얼 객체들을 제어하는 것보다는 부하가 큰 작업을 할 때 좋다.

system.threading.timer는 system.timers.timer와 곧잘 비교된다. 이들을 두고 어려운 설명들을 하는 사람들이 많은데 그냥 단순하게 system.windows.forms.timer와 system.timers.timer 둘 가운데 하나를 쓰면 된다.

It is not recommended for use with Windows Forms, because its callbacks do not occur on the user interface thread. System.Windows.Forms.Timer is a better choice for use with Windows Forms. For server-based timer functionality, you might consider using System.Timers.Timer, which raises events and has additional features.
timer class, microsoft