C#带有2个参数和接口的索引器
示例
interface ITable {
//可以在接口中声明索引器
object this[int x, int y] { get; set; }
}
class DataTable : ITable
{
private object[,] cells = new object[10, 10];
/// <summary>
///在接口中声明的索引器的实现
/// </summary>
/// <param name="x">X-Index</param>
/// <param name="y">Y-Index</param>
/// <returns>Content of this cell</returns>
public object this[int x, int y]
{
get
{
return cells[x, y];
}
set
{
cells[x, y] = value;
}
}
}
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短