Suppose we have code:
CASE 1:
using (SPSite site = new SPSite(SPContext.Current.Web.Url))
{
SPWeb web = site.RootWeb;
}
Do we need to dispose the SPWeb in this case?
CASE 2:
using (SPSite site = new SPSite(SPContext.Current.Web.Url))
{
SPWeb web = new SPSite(SPContext.Current.Web.Url).OpenWeb();
}
Do we need to dispose the SPWeb in this case? Or does it get automatically disposed after the using block disposes the SPSite object?