##// END OF EJS Templates
Working on Unity xml configuration
Working on Unity xml configuration

File last commit:

r252:6f4630d0bcd9 v3
r271:d4d437ec4483 v3
Show More
Disposable.cs
54 lines | 2.1 KiB | text/x-csharp | CSharpLexer
cin
component model refactoring
r152 using Implab.Diagnostics;
using System;
cin
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)...
r208 using System.Diagnostics.CodeAnalysis;
cin
component model refactoring
r152 using System.Threading;
namespace Implab.Components {
/// <summary>
/// Base class the objects which support disposing.
/// </summary>
public class Disposable : IDisposable {
cin
Minor code changes
r213
cin
component model refactoring
r152 public event EventHandler Disposed;
public bool IsDisposed {
cin
Working on runnable component
r250 get; private set;
cin
component model refactoring
r152 }
/// <summary>
/// Asserts the object is not disposed.
/// </summary>
/// <exception cref="ObjectDisposedException">The object is disposed</exception>
/// <remarks>
protected void AssertNotDisposed() {
cin
Working on runnable component
r250 if (IsDisposed)
cin
component model refactoring
r152 throw new ObjectDisposedException(ToString());
}
/// <summary>
/// Вызывает событие <see cref="Disposed"/>
/// </summary>
/// <param name="disposing">Признак того, что нужно освободить ресурсы, иначе данный метод
/// вызван сборщиком мусора и нужно освобождать ТОЛЬКО неуправляемые ресурсы ТОЛЬКО этого
/// объекта.</param>
/// <remarks>
/// Данный метод вызывается гарантированно один раз даже при одновременном вызове <see cref="Dispose()"/>
/// из нескольких потоков.
/// </remarks>
protected virtual void Dispose(bool disposing) {
cin
Minor code changes
r213 if (disposing)
Disposed.DispatchEvent(this, EventArgs.Empty);
cin
component model refactoring
r152 }
cin
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)...
r208 [SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", Justification = "Dipose(bool) and GC.SuppessFinalize are called")]
cin
component model refactoring
r152 public void Dispose() {
cin
Working on runnable component
r250 if(!IsDisposed) {
IsDisposed = true;
cin
component model refactoring
r152 Dispose(true);
GC.SuppressFinalize(this);
}
}
~Disposable() {
Dispose(false);
}
}
}