终于找回了密码!
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}; }}
posted on 2004-03-22 02:46 ipcat.cn 阅读(441) 评论(0) 编辑 收藏 网摘 所属分类: C#
Powered by: 博客园 Copyright © ipcat.cn