var objTypeIndex = from u in context.sistema_DocType_Index where u.docTypeId == id select u.indexId;
indexIds = objTypeIndex.ToList();
int count = indexIds.Count();
string[] names = new string[] {};
int i = 0;
foreach (int indexId in indexIds)
{
//resgata nome do indice e armazena em um array
string strIndiceID = indexId.ToString();
int indiceID = Convert.ToInt32(strIndiceID);
var objIndexName = from u in context.sistema_Indexes where u.id == indiceID select u.idName;
name =
names[i] = objIndexName.First();
i++;
}
最后一行上方的这一行:names[i] = objIndexName.First();
给出以下错误:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
我知道那是什么意思..我只是不知道为什么。