我试图实现使用Razor
该算法的范围之外,但是,我得到这个例外错误:System.IndexOutOfRangeException:索引数组
System.IndexOutOfRangeException:索引已超出界限的的阵列。
@{
//....
for (int i = tab[0]; i <= tab[4]; i++)
{
if (i == pagination.numPageCourrante)
{
<li class="active"><a href="#">@i <span class="sr-only">(current)</span></a></li>
}
else
{//from here the exception triggers
<li><a href="/Accueil/Rechercher?rech=micro&type=nomAppMetier&[email protected](tab[i])">@i </a></li>
}
}
}
知道该表的声明是:
int[] tab = new int[5];
非常感谢!
什么是你的标签数组中值是多少?如果您的for循环不是for(int i = 0; i <= 4 ...)通过执行tab [0]和tab [4],您正在使用这些索引处的值。 – David
标签[4]是什么? – RononDex
Yu必须supress =和写选项卡[4] +1 –