SPWeb.Dispose 方法
Releases all resources used by the current instance of the website.
命名空间: Microsoft.SharePoint
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
Public Sub Dispose
用法
Dim instance As SPWeb
instance.Dispose()
public void Dispose()
实现
备注
使用完此类后,请调用 Dispose。Dispose 方法将此类保留为不可用状态。在调用 Dispose 后,您必须释放对此类的所有引用,以便垃圾回收器回收该类占用的内存。 有关详细信息,请参阅清除非托管资源和实现 Dispose 方法。有关释放 SharePoint 类的特定指南,请参阅 SharePoint Foundation 的最佳实践:释放对象。 注意:在您释放对此类的最后的引用之前,请始终调用 Dispose。否则,不会释放正在使用的资源,直到垃圾回收器调用此对象的 Finalize 方法为止。
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.