// Microsoft.SharePoint.SPWeb public void Close() { if (this.m_closed) { return; } if (this.m_bFirstUniqueAncestorWebInited && this.m_FirstUniqueAncestorWeb != null && !object.ReferenceEquals(this.m_FirstUniqueAncestorWeb, this)) { this.m_FirstUniqueAncestorWeb.Dispose(); this.m_bFirstUniqueAncestorWebInited = false; this.m_FirstUniqueAncestorWeb = null; } if (this.m_Site != null) { if (this == this.m_Site.m_rootWeb) { this.m_Site.m_rootWeb = null; } this.m_Site.InvalidateWeb(this); } if (this.m_ctsAll != null) { foreach (SPContentType sPContentType in this.m_ctsAll) { sPContentType.CloseWebAsNecessary(); } } this.Invalidate(SPContentTypeClass.Field); this.Invalidate(SPContentTypeClass.Type); if (this.m_Site != null) { this.m_Site.RemoveFromOpenedWebs(this); } this.Invalidate(); this.m_closed = true; }
[SharePointPermission(SecurityAction.Demand, ObjectModel=true)] public void Dispose() { this.Close(); }
До кучи System.IO.StreamWriter.Dispose():
// System.IO.TextWriter ///Освобождает все ресурсы, используемые объектом public void Dispose() { this.Dispose(true); GC.SuppressFinalize(this); }.
// System.IO.StreamWriter ///Закрывает текущий объект StreamWriter и базовый поток. ///Текущая кодировка не поддерживает отображение половины суррогатной пары Юникода. ///1 public override void Close() { this.Dispose(true); GC.SuppressFinalize(this); }
// System.IO.StreamWriter ///И еще до кучи (System.Data.SQLClient.SQLConnection.Dispose()):Освобождает неуправляемые ресурсы, используемые /// /// Значение true позволяет освободить управляемые и неуправляемые ресурсы; значение false позволяет освободить только неуправляемые ресурсы. ///(при необходимости освобождает и управляемые ресурсы). Текущая кодировка не поддерживает отображение половины суррогатной пары Юникода. protected override void Dispose(bool disposing) { try { if (this.stream != null && (disposing || (!this.Closable && this.stream is __ConsoleStream))) { this.Flush(true, true); if (this.mdaHelper != null) { GC.SuppressFinalize(this.mdaHelper); } } } finally { if (this.Closable && this.stream != null) { try { if (disposing) { this.stream.Close(); } } finally { this.stream = null; this.byteBuffer = null; this.charBuffer = null; this.encoding = null; this.encoder = null; this.charLen = 0; base.Dispose(disposing); } } } }
protected override void Dispose(bool disposing) { if (disposing) { this._userConnectionOptions = null; this._poolGroup = null; this.Close(); } this.DisposeMe(disposing); base.Dispose(disposing); }
0 коммент.:
Отправить комментарий