DisposableHelpers 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package DisposableHelpers --version 1.0.1
                    
NuGet\Install-Package DisposableHelpers -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DisposableHelpers" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DisposableHelpers" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="DisposableHelpers" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DisposableHelpers --version 1.0.1
                    
#r "nuget: DisposableHelpers, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=DisposableHelpers&version=1.0.1
                    
Install DisposableHelpers as a Cake Addin
#tool nuget:?package=DisposableHelpers&version=1.0.1
                    
Install DisposableHelpers as a Cake Tool

DisposableHelpers

Disposable helpers for IDisposable and IAsyncDisposable. Also capable of both anonymous disposable and anonymous async disposable.

NuGets

Name Info
DisposableHelpers NuGet

Installation

// Install release version
Install-Package DisposableHelpers

// Install pre-release version
Install-Package DisposableHelpers -pre

Supported frameworks

.NET Standard 2.0 and above - see https://github.com/dotnet/standard/blob/master/docs/versions.md for compatibility matrix

Usage

Disposable Sample

using DisposableHelpers;

namespace YourNamespace
{
    public class SampleDisposable : Disposable
    {
        private SampleUnmanagedResource resources;
        
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                resources.Release();
            }
            base.Dispose(disposing);
        }
    }
}

Anonymous Disposable Sample

using DisposableHelpers;

namespace YourNamespace
{
    public static class Program
    {
        private static SampleUnmanagedResource resources;
        
        public static void Main(string[] args)
        {
            Disposable disposable = new Disposable(disposing =>
            {
                if (disposing)
                {
                    resources.Release();
                }
            });

            disposable.Dispose();
        }
    }
}

AsyncDisposable Sample

using DisposableHelpers;

namespace YourNamespace
{
    public class SampleAsyncDisposable : AsyncDisposable
    {
        private SampleAsyncUnmanagedResource resources;
        
        protected override async ValueTask Dispose(bool isDisposing)
        {
            if (isDisposing)
            {
                await resources.Release();
            }
            return base.Dispose(isDisposing);
        }
    }
}

Anonymous AsyncDisposable Sample

using DisposableHelpers;

namespace YourNamespace
{
    public static class Program
    {
        private static SampleAsyncUnmanagedResource resources;
        
        public static async void Main(string[] args)
        {
            AsyncDisposable disposable = new AsyncDisposable(async disposing =>
            {
                if (disposing)
                {
                    await resources.Release();
                }
            });

            await disposable.DisposeAsync();
        }
    }
}

Want To Support This Project?

All I have ever asked is to be active by submitting bugs, features, and sending those pull requests down!.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on DisposableHelpers:

Package Downloads
SingletonSessionHelpers

Provides a base API for singleton session design pattern.

LockerHelpers

Provides helpers for execution locking mechanism.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.101 134 3/25/2025
1.2.99 154 3/24/2025
1.2.98 164 3/17/2025
1.2.97 177 3/12/2025
1.2.93 500 2/20/2025
1.2.92 168 2/20/2025
1.2.90 427 1/27/2025
1.2.89 234 1/20/2025
1.2.88 200 1/16/2025
1.2.86 370 1/10/2025
1.2.84 189 1/8/2025
1.2.83 321 12/31/2024
1.2.82 218 12/27/2024
1.2.81 206 12/26/2024
1.2.80 265 12/18/2024
1.2.79 231 12/17/2024
1.2.78 286 12/6/2024
1.2.77 303 12/5/2024
1.2.76 223 12/5/2024
1.2.75 191 12/3/2024
1.2.74 132 12/3/2024
1.2.73 211 12/3/2024
1.2.71 135 12/3/2024
1.2.70 250 11/25/2024
1.2.69 120 11/25/2024
1.2.68 121 11/22/2024
1.2.67 147 11/22/2024
1.2.64 321 11/20/2024
1.2.63 70 11/19/2024
1.2.62 243 11/14/2024
1.2.60 186 11/13/2024
1.2.59 218 11/12/2024
1.2.58 204 11/8/2024
1.2.57 68 11/8/2024
1.2.56 62 11/8/2024
1.2.55 63 11/8/2024
1.2.54 69 11/7/2024
1.2.53 197 11/6/2024
1.2.52 61 11/6/2024
1.2.51 192 11/5/2024
1.2.50 304 10/30/2024
1.2.49 164 10/30/2024
1.2.48 191 10/29/2024
1.2.47 273 10/28/2024
1.2.46 80 10/25/2024
1.2.45 345 10/23/2024
1.2.44 253 10/22/2024
1.2.43 338 10/17/2024
1.2.42 349 10/14/2024
1.2.41 286 10/11/2024
1.2.40 520 10/7/2024
1.2.39 294 10/4/2024
1.2.38 274 10/2/2024
1.2.37 278 9/27/2024
1.2.36 67 9/27/2024
1.2.35 80 9/27/2024
1.2.34 373 9/25/2024
1.2.33 167 9/25/2024
1.2.32 266 9/23/2024
1.2.31 72 9/23/2024
1.2.30 264 9/20/2024
1.2.29 142 9/20/2024
1.2.28 296 9/18/2024
1.2.27 177 9/16/2024
1.2.26 307 9/10/2024
1.2.24 377 9/5/2024
1.2.23 388 8/29/2024
1.2.22 282 8/26/2024
1.2.21 248 8/22/2024
1.2.20 75 8/22/2024
1.2.19 78 8/22/2024
1.2.18 185 8/20/2024
1.2.17 383 8/14/2024
1.2.16 170 8/13/2024
1.2.15 408 7/31/2024
1.2.14 90 7/31/2024
1.2.13 151 7/26/2024
1.2.12 499 7/16/2024
1.2.11 123 7/15/2024
1.2.10 113 7/13/2024
1.2.9 131 7/12/2024
1.2.8 153 7/9/2024
1.2.7 139 7/8/2024
1.2.6 75 7/8/2024
1.2.5 75 7/8/2024
1.2.4 163 7/7/2024
1.2.3 227 7/1/2024
1.2.2 120 6/30/2024
1.2.1 133 6/28/2024
1.2.0 211 5/3/2024
1.1.16 1,383 10/3/2023
1.1.15 320 8/30/2023
1.1.14 256 8/28/2023
1.1.13 283 8/8/2023
1.1.12 278 7/11/2023
1.1.11 167 7/9/2023
1.1.10 244 6/20/2023
1.1.9 1,766 9/8/2022
1.1.8 407 9/4/2022
1.1.7 420 9/4/2022
1.1.6 2,705 7/20/2022
1.1.5 442 7/20/2022
1.1.4 472 7/17/2022
1.1.3 418 7/17/2022
1.1.2 481 7/17/2022
1.1.1 441 7/17/2022
1.1.0 486 7/17/2022
1.0.2 4,159 3/7/2022
1.0.1 3,318 2/21/2022
1.0.0 1,223 2/17/2022

* Updated package information