C#的数组

C#中提供System.Array类是所有数组类型的基类。
在C#中数组可以是一维的,也可以是多维的,同样也支持矩阵和参差不齐的数组。
using System;
delegate int MyDelegate(); //声明一个代表
class Test
{
    static void Main() // 可动态生成数组的长度
    {
        string[] a1; // 一维string数组
        string[,] a2; // 二维
        string[,,] a3; // 三维
        string[][] j2; // 可变数组
        string[][][][] j3; // 多维可变数组
    }
}

class Test2
{
    static void Main2() // 可动态生成数组的长度
    {
        int[] a1 = new int[]{1, 2, 3};
        int[,] a2 = new int[,]{{1, 2, 3}, {4, 5, 6}};
        int[,,] a3 = new int[10, 20, 30];
        int[][] j2 = new int[3][];
        j2[0] = new int[]{1, 2, 3};
        j2[1] = new int[]{1, 2, 3, 4, 5, 6};
        j2[2] = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9};
    }
}

原文地址:https://www.cnblogs.com/netfork/p/3836.html