Dispose() публичный Метод

Releases unmanaged and - optionally - managed resources
public Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
Результат void
Пример #1
0
        public void IsDisposedAfterDisposeIsTrue()
        {
            var testee = new DisposeNotifyingObject();

            testee.Dispose();

            testee.IsDisposed.Should().BeTrue();
        }
        public void IsDisposedAfterDisposeIsTrue()
        {
            var testee = new DisposeNotifyingObject();

            testee.Dispose();

            testee.IsDisposed.Should().BeTrue();
        }
        public void NotifiesWhenDisposed()
        {
            var disposed = false;
            var testee = new DisposeNotifyingObject();
            testee.Disposed += (sender, e) => disposed = true;

            testee.Dispose();

            disposed.Should().BeTrue();
        }
Пример #4
0
        public void NotifiesWhenDisposed()
        {
            var disposed = false;
            var testee   = new DisposeNotifyingObject();

            testee.Disposed += (sender, e) => disposed = true;

            testee.Dispose();

            disposed.Should().BeTrue();
        }