在C#中,我们对集合的数据,可以创建一个索引器的方法来访问集合。

如:
创建索引器例子

 

class AS
    {
        public string[] Autos = { "德系","欧系","美系","日系","韩系"};

        public string this[int index] {
            get {
                return Autos[index];
            }
        }
    }
Source Code

相关文章:

  • 2021-05-24
  • 2021-10-14
  • 2022-12-23
  • 2021-11-06
  • 2021-11-15
  • 2021-12-20
  • 2021-11-06
  • 2021-11-06
猜你喜欢
  • 2021-05-31
  • 2021-05-25
  • 2022-12-23
  • 2021-05-15
  • 2021-10-12
  • 2022-12-23
相关资源
相似解决方案