Given the following:
class Base<T> {/*...*/}
class Der<T>: Base<T> {/*...*/}
interface Sth<T>{
IEnumerable<Base<T>> Foo {get;}
}
// and implementation...
class Impl<T>: Sth<T> {
public IEnumerable<Base<T>> Foo {
get {
return new List<Der<T>>();
}
}
}
How can I get this to compile? The error is, obviously, not implicit conversion found from List<Der<T>> to List<Base<T>>. If I cast it explicitly InvalidCastException occurs.