In the example below, if client code using GetPeople wanted to print the name and age of each person to the console, it would have to use reflection (I suppose) to determine that query contained an IEnumerable(Of Person) and then cast it as such to get at its properties.
Public Function GetPeople() As IEnumerable
Dim query = From p As Person In People.AsEnumerable() _
Select p
Return query
End Function
The generic form of IEnumerable seems much more informative and useful to clients:
Public Function GetPeople() As IEnumerable(Of Person)
Dim query = From p As Person In People.AsEnumerable() _
Select p
Return query
End Function
I am sure there is a reason - so, why would IEnumerable ever be favored over IEnumerable(Of T)?
Thanks.