• <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>

            關(guān)于this索引器

             11.程序代碼實現(xiàn)索引器
             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來找到對應(yīng)的key
            41              //主要意思是可以對this索引器進行重載
            42        }

            43    }

            44
            45}

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

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


            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            <2011年1月>
            2627282930311
            2345678
            9101112131415
            16171819202122
            23242526272829
            303112345

            導(dǎo)航

            統(tǒng)計

            公告

            關(guān)于更多關(guān)于成大才子,請訪問http://hi.baidu.com/成大才子

            常用鏈接

            留言簿(1)

            隨筆檔案

            文章分類

            文章檔案

            鏈接

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久精品国产WWW456C0M| 久久综合九色综合欧美就去吻| 亚洲精品无码久久千人斩| 久久中文骚妇内射| yellow中文字幕久久网| 中文字幕精品无码久久久久久3D日动漫| 久久人人青草97香蕉| 国产精品一区二区久久精品| 香蕉99久久国产综合精品宅男自| 亚洲精品无码久久久久| 精品久久久无码中文字幕| 久久久久免费精品国产| 狠狠人妻久久久久久综合蜜桃| 久久亚洲精品国产精品婷婷 | 久久久久18| 久久精品亚洲一区二区三区浴池| 久久艹国产| 老司机国内精品久久久久| 无码人妻少妇久久中文字幕蜜桃 | 99久久免费国产特黄| 天天综合久久一二三区| 伊人久久大香线蕉精品| 久久大香香蕉国产| 亚洲国产精品无码久久SM| 亚洲伊人久久综合影院| 久久久久亚洲AV无码专区网站| 精品国产一区二区三区久久久狼 | 2021少妇久久久久久久久久| 国产成人精品综合久久久久| 久久九九久精品国产| 久久精品成人影院| 久久综合久久伊人| 欧美亚洲另类久久综合婷婷 | 亚洲?V乱码久久精品蜜桃| 久久精品这里热有精品| 久久99精品久久只有精品| 久久亚洲国产成人精品性色| AAA级久久久精品无码片| 久久国产高潮流白浆免费观看| 久久久久久久久久久久中文字幕 | 青青草国产精品久久久久|