DisposableHelpers 1.1.4
See the version list below for details.
dotnet add package DisposableHelpers --version 1.1.4
NuGet\Install-Package DisposableHelpers -Version 1.1.4
<PackageReference Include="DisposableHelpers" Version="1.1.4" />
paket add DisposableHelpers --version 1.1.4
#r "nuget: DisposableHelpers, 1.1.4"
// Install DisposableHelpers as a Cake Addin #addin nuget:?package=DisposableHelpers&version=1.1.4 // Install DisposableHelpers as a Cake Tool #tool nuget:?package=DisposableHelpers&version=1.1.4
DisposableHelpers
Disposable helpers for IDisposable and IAsyncDisposable with source generators. Also capable of both anonymous disposable and anonymous async disposable.
NuGets
Name | Info |
---|---|
DisposableHelpers |
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 1
using DisposableHelpers;
namespace YourNamespace
{
public class SampleDisposable : Disposable
{
private SampleUnmanagedResource resources;
protected override void Dispose(bool disposing)
{
if (disposing)
{
resources.Release();
}
base.Dispose(disposing);
}
}
}
Disposable Sample 2
using DisposableHelpers.Attributes;
namespace YourNamespace
{
[Disposable]
public class SampleDisposable
{
private SampleUnmanagedResource resources;
protected 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 1
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);
}
}
}
AsyncDisposable Sample 2
using DisposableHelpers.Attributes;
namespace YourNamespace
{
[AsyncDisposable]
public class SampleAsyncDisposable
{
private SampleAsyncUnmanagedResource resources;
protected 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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. 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. |
.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. |
-
.NETStandard 2.0
- Microsoft.Bcl.AsyncInterfaces (>= 6.0.0)
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on DisposableHelpers:
Package | Downloads |
---|---|
LockerHelpers
Provides helpers for execution locking mechanism. |
|
SingletonSessionHelpers
Provides a base API for singleton session design pattern. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.23 | 92 | 8/29/2024 |
1.2.22 | 236 | 8/26/2024 |
1.2.21 | 201 | 8/22/2024 |
1.2.20 | 30 | 8/22/2024 |
1.2.19 | 27 | 8/22/2024 |
1.2.18 | 139 | 8/20/2024 |
1.2.17 | 338 | 8/14/2024 |
1.2.16 | 118 | 8/13/2024 |
1.2.15 | 369 | 7/31/2024 |
1.2.14 | 52 | 7/31/2024 |
1.2.13 | 106 | 7/26/2024 |
1.2.12 | 457 | 7/16/2024 |
1.2.11 | 81 | 7/15/2024 |
1.2.10 | 69 | 7/13/2024 |
1.2.9 | 77 | 7/12/2024 |
1.2.8 | 110 | 7/9/2024 |
1.2.7 | 90 | 7/8/2024 |
1.2.6 | 33 | 7/8/2024 |
1.2.5 | 34 | 7/8/2024 |
1.2.4 | 123 | 7/7/2024 |
1.2.3 | 188 | 7/1/2024 |
1.2.2 | 82 | 6/30/2024 |
1.2.1 | 94 | 6/28/2024 |
1.2.0 | 171 | 5/3/2024 |
1.1.16 | 1,252 | 10/3/2023 |
1.1.15 | 253 | 8/30/2023 |
1.1.14 | 226 | 8/28/2023 |
1.1.13 | 209 | 8/8/2023 |
1.1.12 | 229 | 7/11/2023 |
1.1.11 | 140 | 7/9/2023 |
1.1.10 | 201 | 6/20/2023 |
1.1.9 | 1,575 | 9/8/2022 |
1.1.8 | 373 | 9/4/2022 |
1.1.7 | 383 | 9/4/2022 |
1.1.6 | 2,556 | 7/20/2022 |
1.1.5 | 403 | 7/20/2022 |
1.1.4 | 433 | 7/17/2022 |
1.1.3 | 396 | 7/17/2022 |
1.1.2 | 443 | 7/17/2022 |
1.1.1 | 405 | 7/17/2022 |
1.1.0 | 448 | 7/17/2022 |
1.0.2 | 3,581 | 3/7/2022 |
1.0.1 | 3,168 | 2/21/2022 |
1.0.0 | 1,152 | 2/17/2022 |
* Updated README.md