我有两个班:
//The class with the Main method
Six ujhb = new(4);
//fill in all the arrays but not the inner arrays
for(int i = 0; i < ujhb.Size; i++) {
ujhb[i] = new int[i+1];
Console.WriteLine(ujhb[i]);
}
//get a value of a specific inner array
Console.WriteLine(ujhb[2][0]);
class Six {
int[][] a;
public int Size;
public Six(int v) {
a = new int[v][];
Size = v;
}
public int[] this[int index] {
get {
return a[index];
}
set {
a[index] = value;
}
}
}
所以我有一个索引器,它获取一个数组或设置一个数组
Console.WriteLine(ujhb[2][0]);
考虑到索引器被告知返回int[]s而不是int[]s?