For 循环不会将值添加到点集合
For loop doesn't add values to a points collection
for 循环没有为我的积分收集增加任何价值:
Esri.ArcGISRuntime.Geometry.PointCollection VMM40Points = new Esri.ArcGISRuntime.Geometry.PointCollection(Spatialreference);
for (int i = 1; i == xyz.Count/3; i += 3)
{
VMM40Points.Add(xyz[i - 1], xyz[i], xyz[i + 1]);
}
这是调试器:https://i.stack.imgur.com/7ZXwA.png
将您的条件更改为 i < xyz.Count/3
。
for 循环的 "while" 部分不正确:它运行 而 条件为真,而不是 直到 。
我不确定你为什么 [i -1]
。有什么特别的原因吗?否则,您会使循环条件变得比必要的复杂得多。
var VMM40Points = new Esri.ArcGISRuntime.Geometry.PointCollection(Spatialreference);
for (int i = 0; i < xyz.Count; i+=3)
{
VMM40Points.Add(xyz[i], xyz[i + 1], xyz[i + 2]);
}
for 循环没有为我的积分收集增加任何价值:
Esri.ArcGISRuntime.Geometry.PointCollection VMM40Points = new Esri.ArcGISRuntime.Geometry.PointCollection(Spatialreference);
for (int i = 1; i == xyz.Count/3; i += 3)
{
VMM40Points.Add(xyz[i - 1], xyz[i], xyz[i + 1]);
}
这是调试器:https://i.stack.imgur.com/7ZXwA.png
将您的条件更改为 i < xyz.Count/3
。
for 循环的 "while" 部分不正确:它运行 而 条件为真,而不是 直到 。
我不确定你为什么 [i -1]
。有什么特别的原因吗?否则,您会使循环条件变得比必要的复杂得多。
var VMM40Points = new Esri.ArcGISRuntime.Geometry.PointCollection(Spatialreference);
for (int i = 0; i < xyz.Count; i+=3)
{
VMM40Points.Add(xyz[i], xyz[i + 1], xyz[i + 2]);
}