System.Timers.Timer的使用
2009-09-29 16:59
489 查看
System.Timers.Timer的使用
2008年11月04日 星期二 05:26 P.M.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
System.Timers.Timer aTimer = new System.Timers.Timer();
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
// Set the Interval to 5 seconds.
aTimer.Interval = 5000;
aTimer.Enabled = true;
Console.WriteLine("Press \'q\' to quit the sample.");
while (Console.Read() != 'q') ;
}
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
Console.WriteLine("Hello World!");
}
}
}
2008年11月04日 星期二 05:26 P.M.
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
System.Timers.Timer aTimer = new System.Timers.Timer();
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
// Set the Interval to 5 seconds.
aTimer.Interval = 5000;
aTimer.Enabled = true;
Console.WriteLine("Press \'q\' to quit the sample.");
while (Console.Read() != 'q') ;
}
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
Console.WriteLine("Hello World!");
}
}
}
相关文章推荐
- .NET System.Timers.Timer的原理和使用(开发定时执行程序)
- C# System.Timers.Timer定时器的使用和定时自动清理内存应用
- Timer控件使用(System.Timers.Timer)
- .NET System.Timers.Timer的原理和使用(开发定时执行程序)
- 使用System.Timers.Timer实现协同
- System.Timers.Timer的使用
- 定时器 System.Timers.Timer的使用
- 在C#中使用System.Timers.Timer
- asp.net中System.Timers.Timer的使用方法
- .NET System.Timers.Timer的原理和使用(开发定时执行程序)
- System.Timers.Timer在asp.net中的使用方法
- .NET System.Timers.Timer的原理和使用(开发定时执行程序)
- .NET System.Timers.Timer的原理和使用(开发定时执行程序)
- Timer控件使用(System.Timers.Timer)
- asp.net中System.Timers.Timer的使用方法
- 在C#中使用System.Timers.Timer
- 在C#中使用System.Timers.Timer
- 转“使用System.Timers.Timer类实现程序定时执行”
- 定时触发函数这System.Timers.Timer对象
- System.Threading.Timer使用心得