EntityCollectionT> to ListT> conversion

.net c# entity-framework

Question

An EntityCollection to a List conversion is what I'm attempting to achieve, but I can't see how to do it.

the following

List<myEntity> entityList = myEntityCollection.ToList();
1
9
10/3/2011 9:23:52 PM

Accepted Answer

You tried:

 List<myEntity> entityList = new List<myEntity>(myEntityCollection);

Additionally, if you import theSystem.Linq There is no reason why the .ToList() extension method shouldn't be included in the namespace:

List<myEntity> entityList = myEntityCollection.ToList();

would not be effective as EntityCollection<T> implements.IEnumerable<T> .

19
10/3/2011 9:45:59 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow