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!");   
  •   
  •          }   
  •   
  •      }   
  •   
  • }
查看全文
  • 相关阅读:
    C#(99):串口编程 System.IO.Ports.SerialPort类
    FastReport.Net的使用
    MongoDB(07):查询文档
    MongoDB(06):文档操作
    HIVE metastore Duplicate key name 'PCS_STATS_IDX' (state=42000,code=1061)
    RSync实现文件备份同步
    env: /etc/init.d/redis: Permission denied
    Multiple MySQL running but PID file could not be found
    centos 6.5卸载Mysql
    web应用性能测试-Tomcat 7 连接数和线程数配置
  • 原文地址:https://www.cnblogs.com/aaa6818162/p/1576496.html
  • Copyright © 2011-2022 走看看