【发布时间】:2016-05-05 17:21:28
【问题描述】:
如何在python c# indexers-like this[int i] {get set}中实现?也就是说,如何在python中编写以下代码?
public class foo{
...
List<foo2> objfoo;
...
public foo2 this[int i] {
get{ return objfoo[i]; }}
}//end class foo
//in another class or method...
ofoo = new foo();
...
foo2 X = ofoo[3];
【问题讨论】: