Ejemplo n.º 1
0
 public void DisposeTest()
 {
     ObjectDisposable o = new ObjectDisposable();
     Assert.False(o.IsDisposed);
     o.Dispose();
     Assert.True(o.IsDisposed);
     Assert.True(ObjectDisposable.IsDisposeManaged);
     Assert.True(ObjectDisposable.IsDisposeUnmanaged);
 }
Ejemplo n.º 2
0
        public void DisposeTest()
        {
            ObjectDisposable o = new ObjectDisposable();

            Assert.False(o.IsDisposed);
            o.Dispose();
            Assert.True(o.IsDisposed);
            Assert.True(ObjectDisposable.IsDisposeManaged);
            Assert.True(ObjectDisposable.IsDisposeUnmanaged);
        }
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposedValue)
            {
                if (disposing)
                {
                    foreach (IDisposable ObjectDisposable in iList)
                    {
                        ObjectDisposable.Dispose();
#if DEBUG
                        Debug.WriteLine("Dispose : " + ObjectDisposable.ToString());
#endif
                    }
                }
            }
            iList.Clear();
            this.disposedValue = true;
        }