• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            關于this索引器

             11.程序代碼實現索引器
             2using System;
             3using System.Collections;
             4using System.Text;
             5
             6namespace IndexerTest
             7{
             8    class Program
             9    {
            10        static void Main(string[] args)
            11        {
            12            IndexClass t_indexClass = new IndexClass();
            13            t_indexClass["001"= "張三";
            14            t_indexClass["002"= "李四";
            15            t_indexClass["003"= "王五";
            16            Console.WriteLine("t_indexClass[0]"+t_indexClass["001"]);
            17            Console.WriteLine("t_indexClass[1]"+t_indexClass["002"]);
            18            Console.WriteLine("t_indexClass[2]"+t_indexClass["003"]);
            19        }

            20    }

            21
            22
            23    class IndexClass //這里索引器是支持重載的
            24    {
            25        private Hashtable name = new Hashtable();
            26
            27        public string this[string index]    //第1個索引器
            28        {
            29            get 
            30            {
            31                return name[index].ToString();
            32            }

            33            set 
            34            {
            35                name.Add(index, value);
            36            }

            37        }

            38        public int this[string index]         //第二個索引器
            39        {
            40              //在這里可以通過遍歷Hashtable來找到對應的key
            41              //主要意思是可以對this索引器進行重載
            42        }

            43    }

            44
            45}

            462.說明,索引器可以被重載.
            473.說明,索引器可以傳遞1~n個參數.
            48

            posted on 2011-01-09 09:26 成大才子 閱讀(310) 評論(0)  編輯 收藏 引用

            <2010年6月>
            303112345
            6789101112
            13141516171819
            20212223242526
            27282930123
            45678910

            導航

            統計

            公告

            關于更多關于成大才子,請訪問http://hi.baidu.com/成大才子

            常用鏈接

            留言簿(1)

            隨筆檔案

            文章分類

            文章檔案

            鏈接

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            av午夜福利一片免费看久久| 久久久精品人妻无码专区不卡| 亚洲国产精品无码久久SM| 亚洲伊人久久精品影院| 久久99精品综合国产首页| 久久人人爽人人爽人人爽| 国产精品免费看久久久| 伊人久久大香线焦AV综合影院| 色综合久久综精品| 区久久AAA片69亚洲| 亚洲性久久久影院| 久久综合欧美成人| 色综合久久久久无码专区 | 日本强好片久久久久久AAA| 久久亚洲精品视频| 九九久久自然熟的香蕉图片| 久久夜色撩人精品国产| 91久久九九无码成人网站| 嫩草伊人久久精品少妇AV| 久久久午夜精品福利内容| 久久久久九国产精品| 久久精品国内一区二区三区| 国产综合久久久久| 久久99精品国产麻豆宅宅| 亚洲精品WWW久久久久久| 精品久久久一二三区| 久久久久国色AV免费观看 | 亚洲AV乱码久久精品蜜桃| 久久久99精品成人片中文字幕| 精品久久久久久国产牛牛app| 99久久精品国产麻豆| 久久久久久亚洲Av无码精品专口| 久久婷婷激情综合色综合俺也去| 色8久久人人97超碰香蕉987| 亚洲午夜久久久久妓女影院| 色8激情欧美成人久久综合电| 久久久久久午夜精品| 久久久噜噜噜久久熟女AA片| 久久99国产精一区二区三区| 精品人妻久久久久久888| 久久噜噜电影你懂的|