简单教程
提交运行
代码编辑器:
@{ var message=""; var weekday=DateTime.Now.DayOfWeek; var day=weekday.ToString() } <!DOCTYPE html> <meta charset="utf-8" /> @switch(day) { case "Monday": message="This is the first weekday."; break; case "Thursday": message="Only one day before weekend."; break; case "Friday": message="Tomorrow is weekend!"; break; default: message="Today is " + day; break; } <p>@message</p>
运行结果: