每当我运行代码时,我都会在控制器中完成代码,为什么会抛出错误“用户代码未处理ArgumentOutOfRangeException”?
public ActionResult GetLicView(int take,int skip)
{
if (Session["FirstName"] != null && Session["userId"] != null &&
Session["guid"] != null)
{
int end = skip + take;
string guid = (string)Session["Guid"];
List<GetAllLicensesDetailsforroles_Result> lic = new
List<GetAllLicensesDetailsforroles_Result>();
lic = manager.GetuserLicensesDetails(guid,
user.getuserrole(Guid.Parse(guid)));
List<GetAllLicensesDetailsforroles_Result> lic2 = new
List<GetAllLicensesDetailsforroles_Result>();
for (int i = skip; i < end; i++)
{
lic2.Add(lic[i]);
}
return Json(lic2, JsonRequestBehavior.AllowGet);
}
else
{
return RedirectToAction("LogOff", "Account");
}
}
在(lic [i])中发生错误,为什么会出现错误以及如何解决它。