C#的定时器
来源:互联网 发布:js购物车加减按钮代码 编辑:程序博客网 时间:2024/06/04 19:01
来自于msdn:
using System;
using System.Timers;
public class Timer1
{
public static void Main()
{
// Normally, the timer is declared at the class level, so
// that it doesn't go out of scope when the method ends.
// In this example, the timer is needed only while Main
// is executing. However, KeepAlive must be used at the
// end of Main, to prevent the JIT compiler from allowing
// aggressive garbage collection to occur before Main
// ends.
System.Timers.Timer aTimer = new System.Timers.Timer();
// Hook up the Elapsed event for the timer.
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
// Set the Interval to 2 seconds (2000 milliseconds).
aTimer.Interval = 2000;
aTimer.Enabled = true;
Console.WriteLine("Press the Enter key to exit the program.");
Console.ReadLine();
// Keep the timer alive until the end of Main.
GC.KeepAlive(aTimer);
}
// Specify what you want to happen when the Elapsed event is
// raised.
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
Console.WriteLine("Hello World!");
}
}
- C#定时器的使用
- C#定时器的使用
- C#定时器的使用
- C#的定时器
- C#定时器的使用
- C#定时器的用法
- c#定时器的使用
- C# 定时器的使用
- C#定时器的用法
- C#定时器的实现
- 关于C#定时器的总结
- 关于C#定时器的总结
- C#中定时器的使用方法
- c#中定时器的实现
- C#列表 定时器的管理
- c#中的定时器的使用
- C#中定时器的使用方法
- C#中定时器的用法
- 一些AS的开源项目
- LINUX 使用tcgetattr函数与tcsetattr函数控制终端一
- 特大优惠:物流软件源码+开发文档
- AS3 库资源 很多非常有用的类库
- LINUX使用tcgetattr函数与tcsetattr函数控制终端二
- C#的定时器
- LINUX 使用tcgetattr函数与tcsetattr函数控制终端三
- 敏捷开发 阶段演示
- 利用stage.invalidate()方法和render事件提高as3程序的运行效率
- LINUX 使用tcgetattr函数与tcsetattr函数控制终端四
- LINUX 使用tcgetattr函数与tcsetattr函数控制终端五
- Key Codes
- JAVA文件操作集合
- 获得真实IP地址及分析 (asp.net C#)