日期:2014-05-20  浏览次数:20721 次

一道小题目,大家帮我做一下,没学过c#,求完全代码,在线等!
一道简单的题目,在线等答案,设计一个类,要求用事件每10秒报告机器的当前时间。各位大侠帮帮忙吧!谢谢

------解决方案--------------------
C# code
namespace ConsoleApplication1
{
    public class Program
    {
        public static void Main()
        {
            MyTimer timer = new MyTimer();
            timer.Interval = 1000;
            timer.Elapsed += delegate(object sender, System.Timers.ElapsedEventArgs e)
            {
                Console.WriteLine(System.DateTime.Now);
            };
            timer.Start();

            Console.ReadKey();
        }
    }

    public sealed class MyTimer : System.Timers.Timer
    {
    }
}

------解决方案--------------------
探讨

C# code
namespace ConsoleApplication1
{
public class Program
{
public static void Main()
{
MyTimer timer = new MyTimer();
timer.Interval = 1000;
……