C# 实例 Switch 条件

c# 实例

switch 条件

@{
var message="";
var weekday=datetime.now.dayofweek;
var day=weekday.tostring()
}
<html>
<body>
@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>
</body>
</html>

相关文章