索引器
来源:互联网 发布:淘宝客成交计入销量吗 编辑:程序博客网 时间:2024/04/30 09:38
定义索引器的方式与定义属性有些类似,其一般形式如下:
[修饰符] 数据类型 this[索引类型 index]
{
get{//获得属性的代码}
set{ //设置属性的代码}
}
class Z{ //可容纳100个整数的整数集 private long[] arr = new long[100]; //声明索引器 public long this[int index] { get { //检查索引范围 if (index < 0 || index <= 100) { return 0; } else { return arr[index]; } } set { if (!(index < 0 || index <= 0)) { arr[index] = value; } } }
- 索引器
- 索引器
- 索引器
- 索引器
- 索引器
- 索引器
- 索引器
- 索引器
- 索引器
- 索引器
- 索引器
- 索引器
- 索引器
- 索引器
- 索引器
- 索引器
- 索引器
- 索引器
- 通过VMware Center Converter转换ubuntu出现grub问题的解决
- 在C中如何使函数返回数组
- T_sql将字符串分割函数
- linux命令:ln(创建链接)
- iphone解锁那点事 (一)
- 索引器
- Android软件测试的日志文件抓取简介
- UTF8采集码
- 模式切换
- Linux 下 Eclipse 界面调整
- [置顶] iphone 软解那点事 (二)
- Linux ALSA声卡驱动之六:ASoC架构中的Machine
- 春晚宫女唐奕霖被爆背景深厚 可携助手出入央视排练场享有特权
- find 命令