Disposer 1.0.4
dotnet add package Disposer --version 1.0.4
NuGet\Install-Package Disposer -Version 1.0.4
<PackageReference Include="Disposer" Version="1.0.4" />
paket add Disposer --version 1.0.4
#r "nuget: Disposer, 1.0.4"
// Install Disposer as a Cake Addin #addin nuget:?package=Disposer&version=1.0.4 // Install Disposer as a Cake Tool #tool nuget:?package=Disposer&version=1.0.4
Disposer
A Source Generator package that generates extension methods for enums, to allow fast "reflection".
This source generator requires the .NET 6 SDK. You can target earlier frameworks like .NET Core 3.1 etc, but the SDK must be at least 6.0.100
Add the package to your application using
dotnet add package Disposer
This adds a <PackageReference>
to your project. You can additionally mark the package as PrivateAsets="all"
.
Setting
PrivateAssets="all"
means any projects referencing this one won't get a reference to the Disposer package. <br/>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<PackageReference Include="Disposer" Version="1.0.0"
PrivateAssets="all" />
</Project>
Adding the package will automatically add a marker attribute, [Disposable]
, to your project.
To use the generator, add the [EnumExtensions]
attribute to an enum. For example:
[Disposer.Disposable]
public class MyClass
{
partial void DisposeManaged()
{
// free managed resources here
}
partial void DisposeUnmanaged()
{
// free Unmanaged resources here
}
}
This will generate a class another partial class which implement IDisposable
interface:
partial class MyClass : global::System.IDisposable
{
partial void DisposeManaged();
partial void DisposeUnmanaged();
private bool disposed = false;
~MyClass()
{
Dispose(false);
}
private void Dispose(bool disposing)
{
if (disposed)
return;
if (disposing)
{
DisposeManaged();
}
DisposeUnmanaged();
disposed = true;
}
public void Dispose()
{
Dispose(true);
global::System.GC.SuppressFinalize(this);
}
}
Product | Versions 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. |
.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 was computed. |
.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
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.