返回列表 发帖

求助这一小段代码中的错误如何修改

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _11._6
{
    class Program
    {
        static void Main(string[] args)
        {
            A ia=new A();
            ia[0]=1;
            Console.Read();
        }
    }
    interface IA
    {
        //private string[] values;
        string this[int index]
        {
            get;//{return values[index];}
            set;//{values[index]=value;}
        }
    }

    public class A : IA
    {
        private string[] values;
        string this [int index]
        {
            get{return values[index];}
            set{values[index]=value;}
        }   
        public A()
        {
            values=new string[10];
        }
    }
}
分享到: QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友

返回列表