##// END OF EJS Templates
fixed ArgumentNullException in StartLogicalOperation
fixed ArgumentNullException in StartLogicalOperation

File last commit:

r40:fe33f4e02ad5 default
r42:3ba6778ed336 default
Show More
Disposable.cs
45 lines | 1.2 KiB | text/x-csharp | CSharpLexer
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Web;
namespace Implab {
public class Disposable : IDisposable {
bool m_disposed;
public event EventHandler Disposed;
public bool IsDisposed {
get { return m_disposed; }
}
protected void AssertNotDisposed() {
if (m_disposed)
throw new ObjectDisposedException(this.ToString());
}
protected virtual void Dispose(bool disposing) {
if (disposing && !m_disposed) {
m_disposed = true;
EventHandler temp = Disposed;
if (temp != null)
temp(this,EventArgs.Empty);
}
}
public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void ReportObjectLeaks() {
Trace.TraceWarning("The object is marked as disposable but isn't disposed properly: {0}", this);
}
~Disposable() {
Dispose(false);
ReportObjectLeaks();
}
}
}