为什么要使用 this 关键字呢?public int A1[int index]
{
Get
{
return M5051[Index];
}
Set
{
M5051[Index]=value;
}
}
public int A6[int index]
{
Get
{
return M5056[Index];
}
Set
{
M5056[Index]=value;
}
}
{
Get
{
return M5051[Index];
}
Set
{
M5051[Index]=value;
}
}
public int A6[int index]
{
Get
{
return M5056[Index];
}
Set
{
M5056[Index]=value;
}
}
解决方案 »
- c#中多线程的问题
- 爸、妈、媳妇有没有车票用这个看---C# 火车票查询助手0.32,支持精确票数显示
- 能不能把VB代码转成.net/C#的类?
- 遍历树结点函数,老是报错,大侠们看看是哪里错了。
- .net下如何制作一个复杂的学生课后练习系统?请大家提提想法
- 如何用正则将html文件内的<img src="123.gif"></img>标记中Src的内容提取出来?
- 一个关于地址栏中文获取的问题,郁闷死了,在线等
- MDI窗体程序中主窗体有N个子窗体,请问实例化问题?
- 导出word文档
- 紧急求教,怎样在控制台程序中正确输出中文?
- 怎么实现全选DataGrid里面的CheckBox ?
- 关于窗口关闭得问题?
public int this [int index]try to add another argument, for example private int [] M5056 = {1,2};
private int [] M5051 = {3,4};
public int this [int index, int index2]
{
get
{
if (index2==0)
return M5056[index];
else
return M5051[index];
}
set
{
if (index2==0)
M5056[index]=value;
else
M5051[index] = value;
}
}then you can do something like CTest c = new CTest();
Console.WriteLine(c[0,0]);
Console.WriteLine(c[1,1]);
c[0,0]=12;
c[1,1]=24;
Console.WriteLine(c[0,0]);
Console.WriteLine(c[1,1]);