I have a code that loops through all the Sites and Webs in a web application. My code uses for..each loop to navigate through each site and web object.
I was wondering if we are required to dispose the SPWeb and SPSite objects when used inside a loop.
Codes:-
foreach (SPSite thisSite in siteAuditWebApplication.Sites) { //My operation here }
Similar to the above code I also have some part of code that loops through all the Web and Lists.
Do we have any best practice for disposing objects inside the loop, or do i really need to take care about disposing the objects?
Thanks in Adv.. Sudhir