使用:
public string getTimeOfDay(TimeOfDay time)
{
string result = string.Empty;
switch (time)
{
case TimeOfDay.Moning:
result = "上午";
break;
case TimeOfDay.Afternoon:
result = "下午";
break;
case TimeOfDay.Evening:
result = "晚上";
break;
default:
result = "未知";
break;
}
return result;
}
枚举方法