mpe*_*pen 6 c# collections inheritance
我想从某种阵列/矢量/列表类的继承,使我可以只添加一个额外的特殊方法将其....是这样的:
public class SpacesArray : ArrayList<Space>
{
public Space this[Color c, int i]
{
get
{
return this[c == Color.White ? i : this.Count - i - 1];
}
set
{
this[c == Color.White ? i : this.Count - i - 1] = value;
}
}
}
Run Code Online (Sandbox Code Playgroud)
但编译器不会让我.说
非泛型类型'System.Collections.ArrayList'不能与类型参数一起使用
我该如何解决这个问题?