私は C# と MVC から離れていました。そして、次のエラーに本当に苦労しています。実際にはわかりません。制限のリストがあり、それらのキーを文字列 [] に追加したいと考えています。
int cntr = 0;
//loop through restrictions and add to array
foreach (var Restriction in this.admingroupRepository.Context.AdminRestrictions.ToList())
{
currentRestrictionKeys[cntr] = Restriction.Key;
cntr += 1;
}
これは、cntr += 1 行で発生するエラーです。
Index was outside the bounds of the array.
これがどこから来たのかわかりません。 cntr が配列の境界を超える前に foreach が壊れますよね?