Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

Razor switch statement

@switch(DateTime.Now.DayOfWeek)
{
    case DayOfWeek.Monday:
        <span>Uh-oh...</span>
		break;
	case DayOfWeek.Friday:
		<span>Weekend coming up!</span>
		break;
	case DayOfWeek.Saturday:
	case DayOfWeek.Sunday:
		<span>Finally weekend!</span>
		break;
	default:
		<span>Nothing special about this day...</span>
		break;
}
Source by asp.mvc-tutorial.com #
 
PREVIOUS NEXT
Tagged: #Razor #switch #statement
ADD COMMENT
Topic
Name
3+9 =