我創建了列表列表來存儲隨機生成的數據,但是我的實現顯示以下intellisense錯誤「變量名稱在當前上下文中不存在」。我哪裏錯了?這是我的代碼所需的部分。列表訪問列表
List<List<string>> DataList = new List<List<string>>();
//Some Code
for (int i = 0; i < num; i++)
{
List<string> strVal = new List<string>();
foreach (string someVal in SomeList)
{
//Some Code
strVal.Add(data);
}
DataList.Add(strVal);
}
for (int i = 0; i < num; i++)
{
foreach (IList<string> name in DataList)
{
foreach (string listVal in strVal) // Error Here
{
//Some Code
}
}
}
我哪裏出錯了?謝謝。
謝謝。有我的錯誤。 –