• <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)  編輯 收藏 引用

            <2025年8月>
            272829303112
            3456789
            10111213141516
            17181920212223
            24252627282930
            31123456

            導航

            統計

            公告

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

            常用鏈接

            留言簿(1)

            隨筆檔案

            文章分類

            文章檔案

            鏈接

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久久国产乱子伦精品作者| 夜夜亚洲天天久久| 无码日韩人妻精品久久蜜桃| 亚洲精品乱码久久久久久蜜桃不卡 | 精品欧美一区二区三区久久久| 精品熟女少妇aⅴ免费久久| 久久天天婷婷五月俺也去| 国产情侣久久久久aⅴ免费| 久久精品国产99久久香蕉| 日韩精品久久久肉伦网站| 狠狠久久综合伊人不卡| 精品熟女少妇a∨免费久久| 亚洲伊人久久成综合人影院| 亚洲国产精品久久久久婷婷软件 | 久久亚洲AV无码精品色午夜| 9191精品国产免费久久| 伊人久久大香线蕉亚洲| 亚洲国产成人久久综合区| 99久久精品免费看国产| 2021久久国自产拍精品| 欧美丰满熟妇BBB久久久| 久久久久亚洲国产| 久久综合一区二区无码| 日本久久久精品中文字幕| 久久久久久无码Av成人影院| 久久久久久久久久久精品尤物 | 欧美午夜精品久久久久免费视| 亚洲人成无码www久久久| 久久se精品一区二区影院 | 久久er国产精品免费观看8| 久久综合九色综合欧美狠狠| 99久久中文字幕| 久久丫精品国产亚洲av不卡| 久久99精品国产麻豆宅宅| 久久精品人妻中文系列| 久久久久亚洲av综合波多野结衣| 亚洲精品国精品久久99热| 久久久这里有精品| 无码国内精品久久人妻| 久久66热人妻偷产精品9| .精品久久久麻豆国产精品 |