⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex-04-12

📁 Programming Csharp Source Code(代码) Programming Csharp Source Code
💻
字号:
//Example 04-12: Using static public constants

public class RightNow
{
   static RightNow()
   {
      System.DateTime dt = System.DateTime.Now;
      Year =      dt.Year;
      Month =     dt.Month;
      Date =      dt.Day;
      Hour =      dt.Hour;
      Minute =    dt.Minute;
      Second =    dt.Second;
   }


   // private member variables
   public static int Year;
   public static int Month;
   public static int Date;
   public static int Hour;
   public static int Minute;
   public static int Second;  
}

public class Tester
{
   static void Main()
   {
      System.Console.WriteLine ("This year: {0}", 
             RightNow.Year.ToString());
      RightNow.Year = 2002;
      System.Console.WriteLine ("This year: {0}", 
      RightNow.Year.ToString());
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -