If an IDisposable
SharePoint object is passed into a function, does an explicit Dispose()
call need to be made on it?
Example:
public void TheCallingFunction()
{
SPSite site = SPContext.Current.Site;
using (SPWeb web = site.OpenWeb("WebName"))
{
DoSomethingRad(web);
}
}
public void DoSomethingRad(SPWeb web)
{
// Do something that's borderline awesome
web.Dispose(); // Yes or no?
}
Roger Lamb's SharePoint 2007 and WSS 3.0 Dispose Patterns by Example doesn't cover this directly (really more of a C# question than an SP question I suppose).