New answers tagged

1

Yes. It's completely fine. Either you can use like below code in using block: using(SPSite oSPsite = new SPSite("http://server")) { using(SPWeb oSPWeb = oSPSite.OpenWeb()) { str = oSPWeb.Title; str = oSPWeb.Url; } } You can get more information from here Reference: https://msdn.microsoft.com/en-us/library/bb687949.aspx https://...


1

If you are explicitly creating object for each of them, then you are supposed to dispose that object also. var site = new SPSite(url); var web = site.OpenWeb(); var list = web.Lists["ListName"]; Here you will need to dispose each object explicitly as a good coding practice like this: web.Dispose(); site.Dispose();



Top 50 recent answers are included