[转帖]c#中time定时器的用法演示_Android, Python及开发编程讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  Android, Python及开发编程讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 3141 | 回复: 0   主题: [转帖]c#中time定时器的用法演示        下一篇 
huarui.ren
注册用户
等级:上尉
经验:692
发帖:56
精华:0
注册:2013-11-5
状态:离线
发送短消息息给huarui.ren 加好友    发送短消息息给huarui.ren 发消息
发表于: IP:您无权察看 2013-11-12 9:10:32 | [全部帖] [楼主帖] 楼主

01usingSystem;01usingSystem;

02usingSystem.Timers;

03

04classTestTimer

05{

    06publicstaticvoidMain ()

    07{

    08Timer timer = newTimer();

    09timer.Elapsed + = newElapsedEventHandler(DisplayTimeEvent);

    10timer.Interval = 1000;

    11timer.Start();

    12timer.Enabled = true;

    13

    14while(Console.Read ()! = 'q')

    15{

    16//-------------

    17}

    18}

    19

    20publicstaticvoidDisplayTimeEvent (objectsource, ElapsedEventArgs e)

    21{

    22Console.Write({0}, DateTime.Now);

    23}

24}

.code_report{float:right} .code_report div{ float: left; margin-left: 5px; background: url("/img/ask-icon.gif") no-repeat; padding: 6px 0 6px 15px; padding-left: 15px; height: 16px;} .code_report a{ background: url("/img/ask-icon.gif") 0 -160px no-repeat;padding-left: 20px; line-height: 15px;height: 16px; color: #333; text-decoration: none; display:inline-block; zoom:1; vertical-align: middle;} .code_report em{ height: 28px; line-height:28px; width: 14px; display: inline-block; float: left; background: url("/img/ask-icon.gif") top right;}

01usingSystem;

02usingSystem.Timers;

03

04classTestTimer

05{

    06publicstaticvoidMain ()

    07{

    08Timer timer = newTimer();

    09timer.Elapsed + = newElapsedEventHandler(DisplayTimeEvent);

    10timer.Interval = 1000;

    11timer.Start();

    12timer.Enabled = true;

    13

    14while(Console.Read ()! = 'q')

    15{

    16//-------------

    17}

    18}

    19

    20publicstaticvoidDisplayTimeEvent (objectsource, ElapsedEventArgs e)

    21{

    22Console.Write({0}, DateTime.Now);

    23}

24}




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论