Realized I forgot one more thing before that will work.
> S newCollection = new S();
> newCollection.Add(this[i]);
In order to call newCollection.Add(), we need the compiler to know that S
actually derives from MyCollection, more specifically MyCollection of the
same type (T). So change the MyCollection definition to:
class MyCollection<T,S> where S : MyCollection<T,S>, new()
It looks a bit redundant, but it ties all the appropriate things together to
let the compiler know that anything of type S is effectively the same as
itself.

Signature
Adam Clauss
> One possibility, add a second type to the generic parameters:
>
[quoted text clipped - 73 lines]
>>
>> Does anybody have any suggestions?
Niels Ull - 19 Oct 2007 12:53 GMT
Thanks - that trick looks like just what I needed.