首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

c#高级编程 里面的例子如何不对啊

2012-01-13 
c#高级编程 里面的例子怎么不对啊?usingSystemusingSystem.Collections.GenericusingSystem.TextusingS

c#高级编程 里面的例子怎么不对啊?
using   System;
using   System.Collections.Generic;
using   System.Text;
using   System.Drawing;


namespace   ConsoleApplication1
{
      public   class   UserPrefernces
      {
              public   static   readonly   Color   BackColor;

                static     UserPreferences()
                {
                  DateTime   now=DateTime.Now;
                        if(now.DayOfWeek==DayOfWeek.Saturday||now.DayOfWeek==DayOfWeek.Sunday)
                                BackColor=Color.Green;
                        else
                                BackColor=Color.Red;
                }

                private   UserPreferences()
                {
                }
      }
     
  class   MainEntryPoint

        {
               
                static   void   Main(string[]   args)
                {
                      Console.WriteLine( "User-Preferences:   BackColor   is:   "+UserPrefernces.BackColor.ToString());
                }
        }
}      

我这都是照着书写的,但是编译提示说
“类、结构或接口方法必须有返回类型”
无法编译啊,怎么回事???

[解决办法]
拼写错误
你的类名是 UserPrefernces
而构造函数名是 UserPreferences

热点排行