读书人

一道小题目大家帮小弟我做一下没学

发布时间: 2012-06-16 20:34:32 作者: rapoo

一道小题目,大家帮我做一下,没学过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;
……

读书人网 >.NET

热点推荐