开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜