Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

If I assign SPContext.Current.Site.OpenWeb().Title to a string, do I need to dispose of it (if possible)?

string title = SPContext.Current.Site.OpenWeb().Title;

I'm still a little fuzzy on when to dispose of sp objects, so I always dispose of my SPWeb and SPSite objects... But, if I don't assign the statement above to an object first, is there any disposing I need to do? I also understand that there are certain cases where using Current eliminates the need to dispose.

Thanks.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

This is a very important topic that is covered well in the following resources:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.