#region using diretives
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#endregionnamespace DeclaringConstructor
{
    public class Time
    {
               int Year;
        int Month;
        int Date;
        int Hour;
        int Minute;
        int Second;
              public void DisplayCurrenTime()
       {
           System.Console.WriteLine("{0}/{1}/{2} {3}:{4}:{5}",Month,Date,Year,Hour,Minute,Second);
       }
                public Time(System.DateTime dt)
        {
         Year=dt.Year;
            Month=dt.Month;
            Date=dt.Day;
            Hour=dt.Hour;
            Minute=dt.Minute;
            Second=dt.Second;
        
        }
    }
public class tester
{
    static void main()
    {
    System.DateTime currenTime=System.DateTime.Now;
        Time t=new Time(currentTime);
        t.DisplayCurrentTime();
    }
}
}

解决方案 »

  1.   

    System.DateTime currenTime=System.DateTime.Now;
      Time t=new Time(currentTime);第一行是currenTime
    第二行是currentTime不一样哦,呵呵
      

  2.   

    DisplayCurrenTime
    这个方法也是这样的错误哦
      

  3.   

    改过来了还是有错,提示如下:
    错误 1 程序“D:\文档\hello\hello\obj\Debug\hello.exe”不包含适合于入口点的静态“Main”方法 ahello
      

  4.   

    改过来了还是有错,提示如下:
    错误 1 程序“D:\文档\hello\hello\obj\Debug\hello.exe”不包含适合于入口点的静态“Main”方法 ahello
      

  5.   

    把你的Main方法
    public class tester
    {
       static void main()
       {
       System.DateTime currenTime=System.DateTime.Now;
       Time t=new Time(currentTime);
       t.DisplayCurrentTime();
       }
    }放在命名空间下
      

  6.   

    是啊,你的控制台程序不屑Main方法肯定报错呗
      

  7.   

    这样吗namespace DeclaringConstructor
    {
        public class tester
        {
            static void main()
            {
                System.DateTime currentTime = System.DateTime.Now;
                Time t = new Time(currentTime);
                t.DisplayCurrentTime();
            }
        }
        public class Time
        {
            int Year;
            int Month;
            int Date;
            int Hour;
            int Minute;
      

  8.   

    哥哥你的main写错了。。要大写Main
      

  9.   


    #region using diretives
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    #endregionnamespace DeclaringConstructor{
        public class Time
        {
            int Year;
            int Month;
            int Date;
            int Hour;
            int Minute;
            int Second;
            public void DisplayCurrenTime()
            {
                System.Console.WriteLine("{0}/{1}/{2} {3}:{4}:{5}", Month, Date, Year, Hour, Minute, Second);
            }
            public Time(System.DateTime dt)
            {
                Year = dt.Year;
                Month = dt.Month;
                Date = dt.Day;
                Hour = dt.Hour;
                Minute = dt.Minute;
                Second = dt.Second;        }
        }
        public class tester
        {
             static  void Main()
            {
                System.DateTime  currenTime = System.DateTime.Now;
                Time t = new Time(currenTime);
                t.DisplayCurrenTime();
            }
        }
    }
      

  10.   

    果然是M写成小写的问题,以前学的是C语言MAIN大小写都可以,C#还有区分这个,谢谢大家了!