I came across this C # code in a project today, and I could not help but doubt its effectiveness:
SPList spList = spWeb.GetListCustom("tasks"); foreach (SPListITem item in spList.GetItems(query)) {
Being against the backdrop of Java, spList.GetItems (query) definitely made me think that its performance was a success. I would do something like the following to improve it:
SPList spList = spWeb.GetListCustom("tasks"); SPListIteCollection taskListCollection = taskList.GetItems(query); foreach (SPListITem item in taskListCollection) {
However, the code is in C # ...
So my question is: could the code I suggested above improve performance, or did I miss something fundamental in the for # C # loop?
Thanks.
source share