国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
索引示例
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Property
{
    class Program
    {
        static void Main(string[] args)
        {
            Myclass class1 = new Myclass();
            for (int i = 0; i < 10; i++)
            {
                for (int j=0;j<10;j++)
                {
                    class1[i * 10, j] = i * 10 + j;
                    Console.WriteLine("No{0}{1}:{2}", i, j, class1[i * 10, j]);
                }
                Console.WriteLine();
            }
            for (int i = 0; i < class1.StrCount; i++)
            {
                Console.WriteLine(class1[i]);//調(diào)用第二個(gè)索引
            }
            class1.StrCount = 5;//設(shè)置StrCount值
            for (int i = 0; i < class1.StrCount; i++)
            {
                Console.WriteLine(class1[i]);//調(diào)用第二個(gè)索引
            }
            Console.WriteLine(Myclass.ClassName);//調(diào)用靜態(tài)方法時(shí)必須用類名對(duì)象調(diào)用
            Console.Write("Press any key to continue");
            Console.ReadLine();
        }
    }
    class Myclass
    {
        private const int count = 100;
        private static int[] intArray = new int[count];
        //第一個(gè)索引函數(shù),支持讀和寫
        public int this[int index, int offset]
        {
            get
            {
                if ((index + offset) > 0 && (index + offset) < count)
                {
                    return intArray[index + offset];
                }
                else
                    return 0;
            }
            set
            {
                if ((index + offset) > 0 && (index + offset) < count)
                {
                    intArray[index + offset] = value;
                }
            }
        }
        private int count1 = 3;
        private string[] strArray = {"111","222","333" };//直接賦值法
        //第二個(gè)索引,只讀
        public string this[int index]
        {
            get
            {
                if ((index) > 0 && (index) < count1)
                {
                    return strArray[index];
                }
                else
                {
                    return "null";
                }
            }
        }
        //實(shí)例屬性可讀可寫
        public int StrCount
        {
            get
            {
                return count1;
            }
            set
            {
                if (value > count1)
                {
                    strArray=new string[value];
                    for (int i = 0; i < value; i++)
                    {
                        strArray[i] = string.Format("String NO.{0}",i);
                    }
                    count1 = value;
                }
            }
        }
        private static string str = "MyClass";
        public static string ClassName
        {
            get
            {
                return str;
            }
        }
    }
}
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
[你必須知道的.NET] 第五回:深入淺出關(guān)鍵字---把new說透
C#中的迭代器(詳解yield)
結(jié)構(gòu)體和類的區(qū)別
C#實(shí)例化指定名稱的類,使用其方法,字段
C#數(shù)據(jù)類型
.net反射詳解
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服