0
當我在asp.net中使用PropertyInfo.SetValue它拋出一個stackoverflow異常,它引發一個stackoverflow異常。 我寫這樣的代碼:當我用戶PropertyInfo.SetValue()
for (int i = 0; i < rivalSeriesIDList.Count; i++)
{
cardb_series rivalSeries = seriesBll.GetSeriesInfoByID(rivalSeriesIDList[i].ToString());
this.GetType().GetProperty("brandid" + (i + 1)).SetValue(this, rivalSeries.brand_id, null);
this.GetType().GetProperty("seriesid" + (i + 1)).SetValue(this, rivalSeries.series_id, null);
}
而且brandid +號和seriesid +號是aspx_page的屬性。像這樣:
public int brandid1
{
get
{
if (Request.Form["brandid1"] != null)
return int.Parse(Request.Form["brandid1"]);
if (Request["brandid1"] != null)
return int.Parse(Request["brandid1"]);
return 0;
}
set
{
brandid1 = value;
}
}
當我在控制檯應用程序中測試代碼時,它是可以的。但是當我在Web應用程序中測試它時,它會導致堆棧溢出異常。 我不知道爲什麼。因爲網絡是沒有國家的? 謝謝。
謝謝! 我是多麼愚蠢! – user189594 2009-10-14 05:25:03