M
MuZZy
Hi,
How do i implement a typed IList class?
Visual Studio automatically generates template code for a IList, but for
example indexer is of type 'object', but i need it of type 'MyType'.
class MyList: IList
{
<...snap...>
public object this[int index]
{
get {return null;}
set {}
}
<...snap...>
}
If i just put 'MyType' instead of 'object' it will of course give an
error that IList.this[index] has a wrong return type.
But i know that somehow it's possible to do that, because a lot of typed
collections, like ToolBarButtonCollection have typed indexers and other
returning interface methods also return typed objects.
Any ideas?
Thank you,
MuZZy
How do i implement a typed IList class?
Visual Studio automatically generates template code for a IList, but for
example indexer is of type 'object', but i need it of type 'MyType'.
class MyList: IList
{
<...snap...>
public object this[int index]
{
get {return null;}
set {}
}
<...snap...>
}
If i just put 'MyType' instead of 'object' it will of course give an
error that IList.this[index] has a wrong return type.
But i know that somehow it's possible to do that, because a lot of typed
collections, like ToolBarButtonCollection have typed indexers and other
returning interface methods also return typed objects.
Any ideas?
Thank you,
MuZZy