Razor练习3
Razor语法中,物质循环处理,它使用到三种: for, while,foreach。
下面Insus.NET分别在ASP.NET MVC环境中列举一个例子,附加源代码:
while:<br /> @{ int a = 0; int b = 5; while (a < b) { @b<br /> b -= 1; } } <br /> foreach:<br /> @{ string ss = "Insus,Insus.NET,Leo,MingBo"; foreach (string s in ss.Split(',')) { @s<br /> } } <br /> for:<br /> @{ int c = 5; for (int d = 0; d <= c; d++) { @d<br /> } }