Hi,
I have a resultset class:
Public Class AResultSet
Implements IEnumerable(Of ConcreteResult)
Private _list As List(Of ConcreteResult)
Public Sub New()
_list = New List(Of ConcreteResult)
End Sub
Public Function GetEnumerator() As System.Collections.Generic.IEnumerator(Of ConcreteResult) Implements System.Collections.Generic.IEnumerable(Of ConcreteResult).GetEnumerator
Return _list.GetEnumerator
End Function
Public Function GetEnumerator1() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
Return _list.GetEnumerator
End Function
End Class
and a linq query:
Dim res As AResultSet = (From pk In testPackages, _
pp In pk.PackagePriceCollection _
Select New ConcreteResult(pk, pp))
But I get a cast error. So if I change the
Dim res As AResultSet
To:
Dim res As IEnumerable(Of ConcreteResult)
It works. But I want to cast the linq query result to the type AResultSet, which is also an IEnumerable(Of ConrecteResult).
Or am I doing something wrong here?