次の方法で共有


SPListItemCollection is particularly inefficient because each loop executes a SQL operation

                SPListItemCollection ic = list.GetItems(qry);
foreach (SPListItem subitem in ic)
{
if (subitem.Folder == null)

Doing a foreach across an SPListItemCollection is particularly inefficient because each loop executes a SQL operation to get the next row of the list.

 

It is better to instead do a GetDataTable(), which doesonly one SQL operation. You can then iterate over the DataRow[].