CSharp examples for System:Array Create
Creates a jagged array with elements of the same length
using System;//from www . jav a 2 s . co m public class Main{ /// <summary> /// Creates a jagged array with elements of the same length /// </summary> /// <typeparam name="T">The element type of the array</typeparam> /// <param name="outerDim">length of the outer dimension</param> /// <param name="innerDim">length of the inner dimension</param> /// <returns></returns> public static T[][] CreateMatrixJagged<T>(int outerDim, int innerDim) { var result = new T[outerDim][]; for (int i = 0; i < outerDim; i++) result[i] = new T[innerDim]; return result; } }