• 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!");   
  •   
  •          }   
  •   
  •      }   
  •   
  • }
  • 相关阅读:
    初识lunece(同义词检索)
    初识IKAnalyzer
    初识springmvc_01
    初识mybatis_03 一级缓存和二级缓存
    初识mybatis_02 基于注解实现增删改查
    初识mybatis_01
    Javascript中的this指向问题
    JS中的深拷贝与浅拷贝
    移动端1像素边框问题
    css的一些知识点的总结(四)
  • 原文地址:https://www.cnblogs.com/aaa6818162/p/1576496.html
  • Copyright © 2020-2023  润新知