Q:由于这些点的个数是不定的,所以在从文件里读的时候,也不能开数据来保存
A:你可以用(如)ArrayList 来存放不定个数的数据
请参考http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemcollectionsarraylistclasstopic.asp

解决方案 »

  1.   

    方便调用的话,可用public static来声明
      

  2.   

    // Creates and initializes a new ArrayList.
          ArrayList myAL = new ArrayList();
          myAL.Add("Hello");
          myAL.Add("World");
          myAL.Add("!");
    这个只是把字符串存进去啊...
      

  3.   

    我想把这些点数据存进去以后,想调用某个点的x,y,z值的时候,就可以方便地找到..
      

  4.   

    可以这样:
    public class dotpoint
    {
       //
       private int _x;
       private int _y;
       private int _z;
       //
       public int X
       {
         get {return this._x;}
         set {this._x=value;}
       }
       public int Y
       {
         get {return this._y;}
         set {this._y=value;}
       }
       public int Z
       {
         get {return this._z;}
         set {this._z=value;}
       }}
    定义一个对象,这个对象就是一个POINT
      

  5.   

    你可以先定义一个结构:
    public struct Point
    {
    public int x, y,z;
    public Point(int p1, int p2, int p3) 
    {
    x = p1;
    y = p2;
    z = p3;
    }
    }
    然后把这些结构存进ArrayList中,
          myAL.Add(Point1);
          myAL.Add(Point2);
    你再使用的时候,
    Point p1 = (Point)ArrayList1[0];
    然后p1.x就可以用了.