Consider the following code:
abstract class SomeClassX<T>
{
// blah
}
class SomeClassY: SomeClassX<int>
{
// blah
}
class SomeClassZ: SomeClassX<long>
{
// blah
}
I want a collection of SomeClassX<T>'s, however, this isn't possible since SomeClassX<int> != SomeClassX<long> and List<SomeClassX<>> isn't allowed.
So my solution is to have SomeClassX<T> implement an interface and define my collection as, where ISomeClassX is the interface:
class CollectionOfSomeClassX: List<ISomeClassX>
{
// blah
}
Is this the best way to do this, or is there better way?