zoukankan      html  css  js  c++  java
  • System.Timers.Timer的使用

    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!");   
  •   
  •          }   
  •   
  •      }   
  •   
  • }
查看全文
  • 相关阅读:
    深圳移动 神州行(大众卡/轻松卡/幸福卡)套餐资费(含香港日套餐)信息及使用方法
    PHP设置时区,记录日志文件的方法
    微信公众平台消息接口使用指南
    C#日期时间格式化
    使用CMD实现批量重命名[转]
    Python高效编程技巧
    实用WordPress后台MySQL操作命令
    ubuntu-wine
    Javascript 笔记与总结(2-8)对象2
    Swift5.3 语言指南(十) 枚举
  • 原文地址:https://www.cnblogs.com/aaa6818162/p/1576496.html
  • Copyright © 2011-2022 走看看