diff options
| author | Bond-009 <bond.009@outlook.com> | 2019-03-27 16:34:26 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-27 16:34:26 +0100 |
| commit | d0fbd260d5cc386119d96f53cdc1d164b80d02df (patch) | |
| tree | 55d465b25aae29128b77d1867f0bfd9a1fc3708f /Emby.Server.Implementations/Net/DisposableManagedObjectBase.cs | |
| parent | 7f42dcc60fd3aaf30f2408f6bddeb2b8bf921cdf (diff) | |
| parent | 524357bfa845e1c01ef280b1d0fc3896b7b9dbaa (diff) | |
Merge branch 'master' into httpclient
Diffstat (limited to 'Emby.Server.Implementations/Net/DisposableManagedObjectBase.cs')
| -rw-r--r-- | Emby.Server.Implementations/Net/DisposableManagedObjectBase.cs | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/Emby.Server.Implementations/Net/DisposableManagedObjectBase.cs b/Emby.Server.Implementations/Net/DisposableManagedObjectBase.cs deleted file mode 100644 index 304b44565..000000000 --- a/Emby.Server.Implementations/Net/DisposableManagedObjectBase.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; - -namespace Emby.Server.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); - - - //TODO Remove and reimplement using the IsDisposed property directly. - /// <summary> - /// Throws an <see cref="ObjectDisposedException"/> if the <see cref="IsDisposed"/> property is true. - /// </summary> - /// <seealso cref="IsDisposed"/> - /// <exception cref="ObjectDisposedException">Thrown if the <see cref="IsDisposed"/> property is true.</exception> - /// <seealso cref="Dispose()"/> - protected virtual void ThrowIfDisposed() - { - if (IsDisposed) throw new ObjectDisposedException(GetType().Name); - } - - #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() - { - IsDisposed = true; - - Dispose(true); - } - - #endregion - } -} |
