c#中“WriteChar”的重载均与委托“System.Timers.ElapsedEventHandler”不匹配
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSy...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
namespace ConsoleApplication4
{
class Program
{
static int counter = 0;
static string displayString = "this one letter";
static void Main(string[] args)
{
Timer myTimer = new Timer(100);
myTimer.Elapsed += new ElapsedEventHandler(WriteChar);
myTimer.Start();
Console.ReadKey();
}
static void WriteChar(Object source, EventHandler e)
{
Console.Write(displayString[counter++ % displayString.Length]);
}
}
} 展开
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
namespace ConsoleApplication4
{
class Program
{
static int counter = 0;
static string displayString = "this one letter";
static void Main(string[] args)
{
Timer myTimer = new Timer(100);
myTimer.Elapsed += new ElapsedEventHandler(WriteChar);
myTimer.Start();
Console.ReadKey();
}
static void WriteChar(Object source, EventHandler e)
{
Console.Write(displayString[counter++ % displayString.Length]);
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询