This project is read-only.

CSC510209. Inappropriate SPList collection usage.


List name is culture specific string or could be changed later:
  • Avoid string based index calls to obtain the list.
  • Avoid using TryGetList method for the List access.

Potential performance issues:
  • Avoid all list enumerations via enumerator calls.
  • Avoid all list enumerations via linq Cast<T> expression.
  • Avoid all list enumerations via linq OfType<T> expression.

Bad code


Consider retrieving list by its URL with SPWeb.GetList() method.


var listUrl = "/lists/tasks";
var taskList = web.GetList(SPUrlUtility.CombineUrl(web.Url, listUrl));


SPWeb.GetList() method
SharePoint Custom Code Performance
Как писать правильный код для SharePoint

Last edited Jun 27, 2014 at 9:27 AM by dvd73, version 18


dvd73 Apr 29, 2014 at 9:13 PM 
Here is a discussion