Здравствуйте, Sinclair, Вы писали:
S>Компилирую простейший пример:
S>S>public static IEnumerable<B> Fail<T, B>(IEnumerable<T> derived)
S> where T : B
S>{
S> return derived; // error CS0266: Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<T>' to 'System.Collections.Generic.IEnumerable<B>'. An explicit conversion exists (are you missing a cast?)
S>}
S>
S>Кто может подсказать, почему это так, и что с этим делать?
public static IEnumerable<B> Fail<T, B>(IEnumerable<T> derived) where T : class, B
{
return derived;
}
Das Reich der Freiheit beginnt da, wo die Arbeit aufhört. (c) Karl Marx