复活啦(http://netfork.cnblogs.com)

终于找回了密码!

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};
    }
}

posted on 2004-03-22 02:46 ipcat.cn 阅读(441) 评论(0)  编辑 收藏 网摘 所属分类: C#





标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
Google站内搜索

China-pub 计算机图书网上专卖店!6.5万品种 2-8折!
近千种 9-95 新二手计算图书火热销售中!
开发者征途系统新作:《设计模式——基于C#的工程化实现及扩展》

相关文章:

相关链接: