c# - 合并Point3DCollection

时间:2011-11-18 06:17:39

标签: c# list collections

我有这段代码:

public Point3DCollection generatePoints()
{
     //generate some Point3D, add them to a Point3DCollection and return it.
     ....
}

//in the main function
Point3DCollection allPoints=new Point3DCollection();

while(...){
   //i need to merge the result from generatePoints() with allPoints, like this:
  allPoints.merge(this.generatePoints());
}

我希望merge()方法有效,(即不使用for循环或逐个添加元素)。我知道泛型列表有一个addRange(),但它不适用于Point3DCollections。有什么建议吗?

1 个答案:

答案 0 :(得分:0)

似乎每个你想要的实现都会在某个时刻收敛。你自己实现这个。编译器将负责优化。