Kotz.ObjectPool 2.2.1-nightly-053

This is a prerelease version of Kotz.ObjectPool.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Kotz.ObjectPool --version 2.2.1-nightly-053
                    
NuGet\Install-Package Kotz.ObjectPool -Version 2.2.1-nightly-053
                    
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="Kotz.ObjectPool" Version="2.2.1-nightly-053" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kotz.ObjectPool" Version="2.2.1-nightly-053" />
                    
Directory.Packages.props
<PackageReference Include="Kotz.ObjectPool" />
                    
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 Kotz.ObjectPool --version 2.2.1-nightly-053
                    
#r "nuget: Kotz.ObjectPool, 2.2.1-nightly-053"
                    
#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 Kotz.ObjectPool@2.2.1-nightly-053
                    
#: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=Kotz.ObjectPool&version=2.2.1-nightly-053&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Kotz.ObjectPool&version=2.2.1-nightly-053&prerelease
                    
Install as a Cake Tool

Kotz.ObjectPool

  • Dependencies:
    • Microsoft.Extensions.ObjectPool

Defines the following types:

  • FluentObjectPool<T>: wrapper for DefaultObjectPool<T> with a more functional-oriented interface.
  • FluentObjectPool: static class containing methods to create an instance of a FluentObjectPool<T>.

How to use

// Basic usage. Let's create a pool of StringBuilders as an example.
var pool = new FluentObjectPool<StringBuilder>(() => new StringBuilder());

// Full usage. Let's create a pool of StringBuilders where:
// - StringBuilders get automatically cleared every time they are returned to the pool.
// - StringBuilders are denied entry to the pool if their string exceeds 50000 in length.
// - The pool cannot hold more than 10 StringBuilders.
var pool = new FluentObjectPool<StringBuilder>(
    () => new StringBuilder(),  // How the object should be instantiated.
    stringBuilder => stringBuilder.Clear(),  // Optional: what should be done to all objects that are returned to the pool.
    stringBuilder => stringBuilder.Length <= 50000,  // Optional: what objects should be accepted when they are returned to the pool. If false, the object is not returned to the pool and may become eligible for garbage collection.
    10  // Optional: the maximum amount of objects the pool is allowed to hold.  Set to zero to disable the limit.
);

Alternatively, you can call FluentObjectPool.Create() to create an object pool.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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 is compatible.  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.  net10.0 was computed.  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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0 145 12/30/2024
3.0.0-nightly-077 104 12/30/2024
2.3.3-nightly-076 103 10/22/2024
2.3.3-nightly-075 127 5/25/2024
2.3.2 174 5/25/2024
2.3.1 164 5/25/2024
2.3.0 160 5/24/2024
2.3.0-nightly-070 127 5/24/2024
2.3.0-nightly-069 138 5/24/2024
2.3.0-nightly-068 138 5/24/2024
2.3.0-nightly-067 136 5/24/2024
2.3.0-nightly-066 141 5/24/2024
2.3.0-nightly-065 130 5/23/2024
2.3.0-nightly-064 134 5/23/2024
2.3.0-nightly-062 137 5/16/2024
2.2.2-nightly-059 135 4/16/2024
2.2.2-nightly-058 140 4/10/2024
2.2.2-nightly-057 142 4/9/2024
2.2.2-nightly-056 138 4/4/2024
2.2.1 201 3/21/2024
2.2.1-nightly-054 107 3/21/2024
2.2.1-nightly-053 124 3/20/2024
2.2.1-nightly-051 118 3/16/2024
2.2.0 249 12/17/2023
2.2.0-nightly-049 145 12/23/2023
2.2.0-nightly-048 128 12/17/2023
2.2.0-nightly-042 153 9/23/2023
2.2.0-nightly-041 146 9/23/2023
2.2.0-nightly-039 135 9/23/2023
2.1.1 517 9/23/2023
2.1.1-nightly-038 180 9/16/2023
2.1.1-nightly-037 178 8/19/2023
2.1.0 255 8/11/2023
2.1.0-nightly-036 233 8/11/2023
2.1.0-nightly-035 231 5/20/2023
2.1.0-nightly-034 262 1/9/2023
2.1.0-nightly-033 229 12/2/2022
2.0.0 501 11/23/2022
2.0.0-nightly-028 235 11/3/2022
2.0.0-nightly-027 265 10/19/2022
2.0.0-nightly-026 233 10/9/2022
2.0.0-nightly-025 251 10/8/2022
2.0.0-nightly-023 266 9/25/2022
2.0.0-nightly-021 249 9/23/2022