We have code where at times we'll be returning an SPWeb object from a function. So for example:
public SPWeb getDeptWeb()
{
SPWeb deptWeb = SpSite.OpenWeb(SpContext.Web.ID);
...
return deptWeb;
}
How can we dispose of the SPWeb object in this instance? Or is it sufficient to dispose it where we're accepting the returned parameter?