【发布时间】:2015-01-02 23:18:04
【问题描述】:
我需要在以下循环之前检查二维整数列表“centreX1”的第一维长度:
for (x = 0; x < (int)centreX1[0].Count(); x++)
{
if (BinarySpotsInsideTolerance1[0][x] == 1)
{
AllspotsY.Add(centreY1[0][x]);
AllspotsX.Add(centreX1[0][x]);
AllspotsRLU.Add(RLUSpotsthreshold1[0][x]);
}
}
如果 centerX1 没有成员,则在 centerX1[0].Count() 处引发错误。
【问题讨论】:
-
在运行代码之前检查
centreX1.Count > 0。 -
如果是数组,那么你的答案就在你的问题标题中
-
不是数组 - 整数列表的列表
标签: c# list multidimensional-array count 2d