using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using System.Drawing;
namespace 静态构造函数
{
class Program
{
static void Main(string[] args)
{
UserPreference user = new UserPreference();
Console.ReadKey();
}
}
public class UserPreference
{
public static readonly Color BackColor;
static UserPreference()
{
DataTime now = DataTime.Now;
if (now.DayOfWeek == DayOfWeek.Monday
|| now.DayOfWeek == DayOfWeek.Saturday)
BackColor = Color.Green;
else
BackColor = Color.Red;
}
private UserPreference()
{
}
}
} |