使用动态数组System.Collections.ArrayList吧,长度随便改
只是取得时候麻烦一点
double tmp = (double)ArrayList[i];

解决方案 »

  1.   


     Cant't
     借助ArrayList另建一个长度为5的double[] ...
      

  2.   

    C#中没有redim函数,但你可以通过Array对象实现redim函数。
    以下是Microsoft .Net框架程序设计(修订版)中实现 redim函数的方法:
    public static Array Redim(Array origArray,Int32 desiredsize)
    {
         //确定每个元素类型 
         Type t=origArray.GetType().GetElementType();
         //创建一个含有期望元素个数的新数组
         //新数组的类型必须匹配原数组的类型
         Array newArray=Array.CreateInstance(t,desiredsize);
         //将原数组中的元素拷贝到新数组中
         Array.Copy(origArray,0,newArray,0,Math.Min(origArray.Length,desiredsize));
         return  newArray;
    }
      

  3.   

    不借助ArrayList类对Array进行操作
    改变数组的大小
    public static Array Resize(Array array, int newSize)
        {
            Type type = array.Type;
            Array newArray = Array.CreateInstance(type.GetElementType(), newSize);
            Array.Copy(array, 0, newArray, 0, Math.Min(newArray.Length, newSize))l
            return newArray;
        }
    参考:
    http://dev.csdn.net/develop/article/16/16749.shtm