C# Timer
using System;
<br>using System.Collections.Generic;
<br>using System.Text;
<br>using System.Timers;
<br>
<br>namespace CATwo
<br>{
<br> class Event
<br> {
<br> static int counter = 0;
<br> static string str = "This is the string you want to write!";
<br> static void Main(string[] args)
<br> {
<br> Timer T = new Timer(200);
<br> T.Elapsed += new ElapsedEventHandler(WriteChar);
<br> T.Start();
<br> Console.ReadLine();
<br> }
<br> public static void WriteChar(object source, ElapsedEventArgs e)
<br> {
<br> Console.WriteLine(str[counter++ % str.Length]);
<br> }
<br> }
<br>}
<br>
<br>错误1 “Timer”方法没有采用“1”个参数的重载
<br>错误2 “CATwo.Timer”并不包含“Elapsed”的定义
<br>错误3 “CATwo.Timer”并不包含“Start”的定义

- 这是一篇来自百度知道的问题
|