最近在使用sps类库过程中发现了一个让我比较疑惑的问题(有关items属性的)

大家都知道 SPList对象有个属性 items ,在文档中是这样解释的

The Items property of the SPList class gets the collection of all items in the list. Remarks返回当前 List中的所有的item对象集合

The Items property returns all the files in a document library, including files in subfolders, but not the folders themselves. In a document library, folders are not considered items. 在一个document library(文档库)中返回其下所有的文件不包括其目录。

我们在做一个项目,使用wss做后台存储,开发环境数据库中现在有大概2G多的数据,其中主要用的是list 和 document library  站点下大概有查不多1000来个list和 document library ,测试发现性能极其差,每个操作大都需要几秒钟左右,后来反复测试才发现问题处在---- List.Items 属性返回 的时间大概都要用4秒来钟,这弱智得东西,这不是坑人嘛。后来我把这个属性换成GetItems(Microsoft.SharePoint.SPView) 方法(The GetItems method of the SPList class returns a collection of list items from the list based on the specified view. )

具体我是这样用的objList.GetItems(objList. DefaultView),再次测试结果发现返回items集合只用了0.3秒左右的时间。

我就不明白了~都是同一家公司出的如此相似的两个操作性能差距砸就那大尼。

看来以后items属性千万不能用 ,直接cut掉得拉

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值