Exemple #1
0
 /// <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 override void Dispose(bool disposing)
 {
     if (disposing)
     {
         Stop();
         DisposeHelper.Dispose(signal);
     }
 }
 /// <summary>
 /// Calls the dispose methode on a IDisposable and sets the reference to null.
 /// If the given reference is unable to be casted to IDisposable only the reference will be set to null.
 /// </summary>
 /// <typeparam name="T">Type of the reference to dispose and set.</typeparam>
 /// <param name="obj">Reference to cast, dispose and set to null.</param>
 public static void DisposeAndNull <T>(ref T obj)
     where T : class
 {
     DisposeHelper.Dispose(obj);
     obj = null;
 }