Hi
is there a way todo this in C#
class MyClass {
protected MyType1[] m_MyTypes1;
protected MyType2[] m_MyTypes2;
public MyClass() { . . . }
public MyType1 this[ int position ] {
get {
return m_MyTypes1[ position ];
}
}
public MyType2 this[ int position ] {
get {
return m_MyTypes2[ position ];
}
}
}
void Foo() {
MyClass m = new MyClass();
MyType1 m1 = m[ 1 ];
MyType2 m2 = m[ 1 ];
}
This won´t compile because there can´t be 2 this-operator overloads that
take the same arguments.
Any ideas how i can do this without using direct (SetMyType/GetMyType)
methods?
thx
Kimmo Laine