Disposable Object Base (Core/DisposableObject.cs)

git-credential-manager · src/Core/DisposableObject.cs · csharp · MIT
infra, tag:disposable, tag:pattern, tag:resource, tag:management, tag:base

Base class implementing IDisposable pattern for resource management

// Source: https://github.com/git-ecosystem/git-credential-manager | License: MIT | Copyright GitHub, Inc. and contributors
// Provided via justclaw.it.com; keep this notice with the code.
using System;

namespace GitCredentialManager
{
    /// <summary>
    /// An object that implements the <see cref="IDisposable"/> interface and the disposable pattern.
    /// </summary>
    public abstract class DisposableObject : IDisposable
    {
        private bool _isDisposed;

        /// <summary>
        /// Throw an exception if the object has been disposed.
        /// </summary>
        /// <exception cref="ObjectDisposedException">Thrown if the object has been disposed.</exception>
        protected void ThrowIfDisposed()
        {
            if (_isDisposed)
            {
                t

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key