Why can a List(Of SomeObject) not be converted to an IEnumerable(Of ISomeInterface) while SomeObject
Posted
by ropstah
on Stack Overflow
See other posts from Stack Overflow
or by ropstah
Published on 2010-03-28T22:59:00Z
Indexed on
2010/03/28
23:03 UTC
Read the original article
Hit count: 98
Please see the last comment in GetListChildren()
function. "Why can a List(Of Page) not be converted to an IEnumerable(Of IListHasChildren) ?"
Interface IListHasChildren
Function GetListChildren() as IEnumerable(Of IListHasChildren)
End Interface
Public Class Page : Implements IListHasChildren
Public Function GetChildren() As List(Of Page)
//'return List(Of Page) with children
End Function
Public Function GetListChildren() : Implements IListHasChildren.GetListChildren
Return Me.GetChildren() //'This cannot be converted to IEnumerable(Of IListHasChildren) ??
End Function
End Class
© Stack Overflow or respective owner