1
vote
Vote UpVote

Casting lists using LINQ

Coding Power Unleashed – I have been doing lately much work on a .NET 3.5 application using LINQ. LINQ is a great way to manipulate data. I still consider myself a 'LINQ rookie' so I discover everyday something new. One thing that floated around my head a while was the problem that you can't cast a List<SomeDerivedObject> to List<SomeBaseObject>. A poorman's solution to this was to loop the objects from the one list into the other list. Not an elegant solution though..... I discovered that you can do this easily with LINQ. When you use a IEnumerable<T> you can do this like this: Code ...
Favorite? Off-Topic? Roland Beenhakker @ 2009-11-04 01:05

Statistics

Visits: 423
Votes: 1
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

jamiei
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)