Scenario: I have a collection of entity framework entities using lazy loading and are therefor DynamicProxies
. Then there is a a method that passes some selected items to an override I'm writing as object
. I need to convert the List<DynamicProxies.EntityABCD>
(which is actually passed as object
) to a List<Entity>
.
However casting the list this way
dropInfo.Data as List<MyEntity>
will return null. I can't even use the generic method Cast<T>
because again the source list is passed as an object
.
I also tried
dropInfo.Data as List<object>
but it still will return null.
Thanks in advance
EDIT: Managed to get a cleaner list with
((IList)dropInfo.Data).Cast<MyEntity>()
However I still need to check for errors etc.