开发者

Why can't I use Enumerable.OrderBy on this collection?

开发者 https://www.devze.com 2023-03-02 22:46 出处:网络
I was hoping to use OrderBy on a SPFolderCollection object but after I include System.Linq, OrderBy still does not come up in intellisense.

I was hoping to use OrderBy on a SPFolderCollection object but after I include System.Linq, OrderBy still does not come up in intellisense.

According to the Documentation, SPFolderCollectionClass inherits from SPBaseCollection which u开发者_开发知识库ses IEnumerable. I thought this was all that I needed, am I missing something?


Most of the LINQ methods require an IEnumerable<T>, use the Enumerable.Cast method to convert it.

So x.Cast<SPFolder>().OrderBy(whatever).


OrderBy will appear only on a IEnumerable<T> generic class. IEnumerable is different from IEnumerable<T>


Perhaps you mixed up System.Collections.Generic.IEnumerable<T> interface and System.Linq.Enumerable class

0

精彩评论

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