1
vote
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 ...
Statistics
|
Visits by Source |
User Actions |




