Can u please explain me which is fast and why or any other option to fast call any list
1) web.GetList(String.Format(“{0}/Lists/{1}/AllItems.aspx”, web.Url, listname))
2) web.lists[listname]
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Its impossible to really know without digging out reflector and profiling tools since the documentation doesn’t tell us but generally you would expect the 1st to be more efficient.
The reason is that SPWeb.GetList is getting one SPList object from SharePoint.
However web.lists is getting a SPListCollection containing ALL lists in the web and you are then finding the one you want with [listName] (see overloaded Item property)