Link to home
Start Free TrialLog in
Avatar of raterus
raterusFlag for United States of America

asked on

LINQ cast to collection classes

I'm looking for a on-liner fix to the following problem.

I have the following collection class

Public Class Authors
	Inherits Collection(Of Author)
End Class

Open in new window


And a method to get some Authors

Dim myAuthorsCollection = AuthorModel.GetSomeAuthorDudes()

Open in new window


I run some LINQ

Dim filteredAuthors = myAuthorsCollection.Where(function(p) p.authorTypeID=1)

Open in new window


Now my problem, in the above example "filteredAuthors" is now an IEnumerable(Of Author), but I want to quickly get it back to an "Authors" collection.  Is there a simple way to do this, other than creating a new "Authors" collection and creating a for loop to add authors back to it?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial