开发者

How to convert EntityCollection<T> to List<T>

开发者 https://www.devze.com 2023-04-10 02:58 出处:网络
I\'m trying to convert an Enti开发者_开发技巧tyCollection to a List but I don\'t see a way to do this.

I'm trying to convert an Enti开发者_开发技巧tyCollection to a List but I don't see a way to do this.

Something like:

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


Did you try:

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

And by the way if you import the System.Linq namespace in order to bring the .ToList() extension method into scope, there's no reason why:

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

wouldn't work as EntityCollection<T> implements IEnumerable<T>.

0

精彩评论

暂无评论...
验证码 换一张
取 消