128 lines
3.1 KiB
C#

namespace View_by_Distance.FaceRecognitionDotNet;
/// <summary>
/// Represents a class which has managed or unmanaged resources.
/// </summary>
public abstract class DisposableObject : IDisposable
{
#region Properties
/// <summary>
/// Gets a value indicating whether this instance has been disposed.
/// </summary>
/// <returns>true if this instance has been disposed; otherwise, false.</returns>
public bool IsDisposed
{
get;
private set;
/* Unmerged change from project 'FaceRecognitionotNet(netstandard2.0)'
Before:
/// If this object is disposed, then <see cref="System.ObjectDisposedException"/> is thrown.
After:
/// If this object is disposed, then <see cref="ObjectDisposedException"/> is thrown.
*/
}
#endregion
#region Methods
/// <summary>
/// If this object is disposed, then <see cref="ObjectDisposedException"/> is thrown.
/// </summary>
public void ThrowIfDisposed()
{
if (IsDisposed)
throw new ObjectDisposedException(GetType().FullName);
}
internal void ThrowIfDisposed(string objectName)
{
if (IsDisposed)
throw new ObjectDisposedException(objectName);
}
#region Overrides
/// <summary>
/// Releases all managed resources.
/// </summary>
protected virtual void DisposeManaged()
{
}
/// <summary>
/// Releases all unmanaged resources.
/// </summary>
protected virtual void DisposeUnmanaged()
{
}
#endregion
#endregion
#region IDisposable Members
/// <summary>
/// Releases all resources used by this <see cref="DisposableObject"/>.
/// </summary>
public void Dispose()
{
GC.SuppressFinalize(this);
/* Unmerged change from project 'FaceRecognitionotNet(netstandard2.0)'
Before:
Dispose(true);
After:
Dispose(true);
*/
Dispose(true);
}
/// <summary>
/// Releases all resources used by this <see cref="DisposableObject"/>.
/// </summary>
/// <param name="disposing">Indicate value whether <see cref="IDisposable.Dispose"/> method was called.</param>
private void Dispose(bool disposing)
{
if (IsDisposed)
{
return;
/* Unmerged change from project 'FaceRecognitionotNet(netstandard2.0)'
Before:
IsDisposed = true;
After:
IsDisposed = true;
*/
}
IsDisposed = true;
if (disposing)
/* Unmerged change from project 'FaceRecognitionotNet(netstandard2.0)'
Before:
DisposeManaged();
After:
DisposeManaged();
*/
DisposeManaged();
/* Unmerged change from project 'FaceRecognitionotNet(netstandard2.0)'
Before:
DisposeUnmanaged();
After:
DisposeUnmanaged();
*/
DisposeUnmanaged();
}
#endregion
}