System.DisposableObject 10.0.0

dotnet add package System.DisposableObject --version 10.0.0
                    
NuGet\Install-Package System.DisposableObject -Version 10.0.0
                    
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="System.DisposableObject" Version="10.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="System.DisposableObject" Version="10.0.0" />
                    
Directory.Packages.props
<PackageReference Include="System.DisposableObject" />
                    
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 System.DisposableObject --version 10.0.0
                    
#r "nuget: System.DisposableObject, 10.0.0"
                    
#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.
#:package System.DisposableObject@10.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=System.DisposableObject&version=10.0.0
                    
Install as a Cake Addin
#tool nuget:?package=System.DisposableObject&version=10.0.0
                    
Install as a Cake Tool

Nuget Nuget

System.DisposableObject

Base object for disposing managed and unmanaged objects. This object implements the dispose pattern for the .NET Framework.

Example

Create a class and inherit from DisposableObject as shown below:

using System;

public class SomeObject : DisposableObject
{
  protected override void OnDisposeManagedObjects()
  {
    //
    // Disposed CLR managed objects here.
    //
  }

  protected override void OnDisposeUnmanagedObjects()
  {
    //
    // Disposed non-CLR managed objects here.
    //
  }
}

Override one or both of the above methods depending on the type of resources your class uses.

When instantiating the class. wrap it in a using statement.

using (SomeObject obj = new SomeObject())
{
  //
  // obj will be disposed and the dispose
  // methods will be called.
}

or call the Dispose() method.

SomeObject obj = new SomeObject();
obj.Dispose();

In either case, the OnDisposeManagedObjects() and OnDisposeUnmanagedObjects() are called.

References

  1. https://docs.microsoft.com/en-us/dotnet/api/system.idisposable

  2. https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (12)

Showing the top 5 NuGet packages that depend on System.DisposableObject:

Package Downloads
Diamond.Core.System.TemporaryFolder

This library provides code performance tools.

Diamond.Core.Repository.EntityFrameworkCore

This library provides an implementation of the repository that can be used with Entity Framework Core.

System.Data.FileDatabase

A library for easy access to File based databases such as Microsoft Access, flat files or Excel Spreadsheets.

Diamond.Patterns.Context

This library provides context implementations the work-flows and other context based operations.

Diamond.Patterns.System

This library provides some basic support functionality.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on System.DisposableObject:

Repository Stars
porrey/Virtual-ZPL-Printer
An ethernet based virtual Zebra Label Printer that can be used to test applications that produce bar code labels.
Version Downloads Last Updated
10.0.0 380 11/15/2025
9.0.0 1,007 11/14/2024
8.0.0 1,663 11/25/2023
1.5.1 11,296 1/16/2022
1.5.0 929 1/16/2022
1.4.1 11,685 12/3/2020
1.4.0 1,020 12/2/2020
1.3.2 5,903 4/14/2020
1.3.1 2,818 1/27/2020