본문 바로가기

Programming/ASP .NET

c#에서 타이머 사용하기

Timer aTimer = new Timer();

// Hook up the Elapsed event for the timer.
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);

// Set the Interval to 5 seconds (5000 milliseconds).
aTimer.Interval = 5000;
aTimer.Enabled = true;

void OnTimedEvent(object source, ElapsedEventArgs e)
{
    // Todo:: 할일...        
}