/// <summary> /// Disposes the resources and references associated to the /// <see cref="AssemblyBase"/>. /// </summary> /// <param name="disposing">Whether to release the managed resources /// as well as the unmanaged resources.</param> protected virtual void Dispose(bool disposing) { try { lock (this.SyncObject) { this.manifestModule = null; if (this.attributes != null) { this.attributes.Dispose(); } if (this.namespaces != null) { this.namespaces.Dispose(); this.namespaces = null; } if (this.classes != null) { this.classes.Dispose(); this.classes = null; } if (this.enums != null) { this.enums.Dispose(); this.enums = null; } if (this.delegates != null) { this.delegates.Dispose(); this.delegates = null; } if (this.interfaces != null) { this.interfaces.Dispose(); this.interfaces = null; } if (this.structs != null) { this.structs.Dispose(); this.structs = null; } if (this.modules != null) { foreach (var module in this.modules.Values) { module.Dispose(); } this.modules = null; } this.types = null; this.isDisposed = 1; } } finally { this.OnDisposed(); this.Disposed = null; GC.SuppressFinalize(this); } }
/// <summary> /// Checks the initialization status of the <see cref="Types"/> /// associated to the <see cref="AssemblyBase"/>. /// </summary> internal void CheckTypes() { lock (this.SyncObject) if (this.types == null) { if (this.IsDisposed) { throw new InvalidOperationException(Resources.ObjectStateThrowMessage); } this.types = this.InitializeTypes(); } }