//比如有数组 
float[] a=new float[]{3,1}//如何得到a的五倍  
 {15,5}

解决方案 »

  1.   


    float[] a = new float[] { 3, 1 };
                for (int i = 0; i < a.Length; i++)
                    a[i] = a[i] * 5;
                foreach (float f in a)
                    Console.WriteLine(f.ToString());
      

  2.   


    float[] a = new float[] { 3, 1 };
                for (int i = 0; i < a.Length -1 ; i++)
                    a[i] = a[i] * 5;
                foreach (float f in a)
                    Console.WriteLine(f.ToString());少了
      

  3.   

    http://topic.csdn.net/u/20100115/15/b47d75cf-c95d-45b7-95f3-ffad6eff0fe3.html
      

  4.   

    你这2维数组如果想得到一个5倍空间的数组,扩充任何一个下标都可以达到,如果你想得到里面值的5倍就循环吧
    for(int i=0;i<3;i++)
    {
      for(int j=0;j<1;j++)
    {
        float k=a[i][j]*5;
    }
    }
      

  5.   

    用Linq...C# 3.0以上支持...
    a = a.Select(f => f * 5).ToArray();