TrySetAppDatabaseAsAccessed method
TrySetAppDatabaseStorageState method
Expand Minimize

SPWeb.Dispose method

Releases all resources used by the current instance of the website.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public void Dispose()

Implements

IDisposable.Dispose()

Call Dispose when you are finished using this class. The Dispose method leaves this class in an unusable state. After calling Dispose , you must release all references to this class so the garbage collector can reclaim the memory that the class was occupying. For more information, see Cleaning Up Unmanaged Resources and Implementing a Dispose Method. For specific guidance on disposing SharePoint classes, see Best Practices with SharePoint Foundation: Disposing Objects. Note Always call Dispose before you release your last reference to this class. Otherwise, the resources it is using will not be freed until the garbage collector calls this object's Finalize method.

This method simply calls the Close method. Uses this method or the Close method to release the resources of the SPWeb object when you are finished using the object. Do not reuse the object or objects that are obtained through the object after it is closed.

If you create a SPWeb object, you can use this method to close the object. However, if you have a reference to a shared resource, such as when the object is provided by the SPControl.GetContextWeb method, do not use this method to close the object, but instead allow SharePoint Foundation or your portal application to manage the object. For more information about object disposal, see Disposing Objects.

Show:
© 2014 Microsoft