aboutsummaryrefslogtreecommitdiff
path: root/Emby.Common.Implementations/Net/DisposableManagedObjectBase.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-08-18 02:04:21 -0400
committerGitHub <noreply@github.com>2017-08-18 02:04:21 -0400
commitc58db90c950c766321615eca236557d87b8d1b74 (patch)
tree80f1823f901bdadad6af4fce8d36d9b73f79c0fb /Emby.Common.Implementations/Net/DisposableManagedObjectBase.cs
parentd5a9db3af77b06a355558165a984328e35555279 (diff)
parent883399caeba54da4c9f3e15e639f8fd72f5b559e (diff)
Merge pull request #2827 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Common.Implementations/Net/DisposableManagedObjectBase.cs')
-rw-r--r--Emby.Common.Implementations/Net/DisposableManagedObjectBase.cs74
1 files changed, 0 insertions, 74 deletions
diff --git a/Emby.Common.Implementations/Net/DisposableManagedObjectBase.cs b/Emby.Common.Implementations/Net/DisposableManagedObjectBase.cs
deleted file mode 100644
index 8476cea32..000000000
--- a/Emby.Common.Implementations/Net/DisposableManagedObjectBase.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace Emby.Common.Implementations.Net
-{
- /// <summary>
- /// Correclty implements the <see cref="IDisposable"/> interface and pattern for an object containing only managed resources, and adds a few common niceities not on the interface such as an <see cref="IsDisposed"/> property.
- /// </summary>
- public abstract class DisposableManagedObjectBase : IDisposable
- {
-
- #region Public Methods
-
- /// <summary>
- /// Override this method and dispose any objects you own the lifetime of if disposing is true;
- /// </summary>
- /// <param name="disposing">True if managed objects should be disposed, if false, only unmanaged resources should be released.</param>
- protected abstract void Dispose(bool disposing);
-
- /// <summary>
- /// Throws and <see cref="System.ObjectDisposedException"/> if the <see cref="IsDisposed"/> property is true.
- /// </summary>
- /// <seealso cref="IsDisposed"/>
- /// <exception cref="System.ObjectDisposedException">Thrown if the <see cref="IsDisposed"/> property is true.</exception>
- /// <seealso cref="Dispose()"/>
- protected virtual void ThrowIfDisposed()
- {
- if (this.IsDisposed) throw new ObjectDisposedException(this.GetType().FullName);
- }
-
- #endregion
-
- #region Public Properties
-
- /// <summary>
- /// Sets or returns a boolean indicating whether or not this instance has been disposed.
- /// </summary>
- /// <seealso cref="Dispose()"/>
- public bool IsDisposed
- {
- get;
- private set;
- }
-
- #endregion
-
- #region IDisposable Members
-
- /// <summary>
- /// Disposes this object instance and all internally managed resources.
- /// </summary>
- /// <remarks>
- /// <para>Sets the <see cref="IsDisposed"/> property to true. Does not explicitly throw an exception if called multiple times, but makes no promises about behaviour of derived classes.</para>
- /// </remarks>
- /// <seealso cref="IsDisposed"/>
- public void Dispose()
- {
- try
- {
- IsDisposed = true;
-
- Dispose(true);
- }
- finally
- {
- GC.SuppressFinalize(this);
- }
- }
-
- #endregion
- }
-}