📄 ex-04-12
字号:
//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 + -