Kotz.ObjectPool 3.0.0

dotnet add package Kotz.ObjectPool --version 3.0.0
                    
NuGet\Install-Package Kotz.ObjectPool -Version 3.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="Kotz.ObjectPool" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kotz.ObjectPool" Version="3.0.0" />
                    
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 3.0.0
                    
#r "nuget: Kotz.ObjectPool, 3.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 Kotz.ObjectPool@3.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=Kotz.ObjectPool&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Kotz.ObjectPool&version=3.0.0
                    
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 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 is compatible.  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 121 12/30/2024
3.0.0-nightly-077 90 12/30/2024
2.3.3-nightly-076 97 10/22/2024
2.3.3-nightly-075 117 5/25/2024
2.3.2 158 5/25/2024
2.3.1 142 5/25/2024
2.3.0 147 5/24/2024
2.3.0-nightly-070 108 5/24/2024
2.3.0-nightly-069 119 5/24/2024
2.3.0-nightly-068 118 5/24/2024
2.3.0-nightly-067 117 5/24/2024
2.3.0-nightly-066 122 5/24/2024
2.3.0-nightly-065 111 5/23/2024
2.3.0-nightly-064 115 5/23/2024
2.3.0-nightly-062 118 5/16/2024
2.2.2-nightly-059 116 4/16/2024
2.2.2-nightly-058 120 4/10/2024
2.2.2-nightly-057 123 4/9/2024
2.2.2-nightly-056 124 4/4/2024
2.2.1 188 3/21/2024
2.2.1-nightly-054 93 3/21/2024
2.2.1-nightly-053 110 3/20/2024
2.2.1-nightly-051 104 3/16/2024
2.2.0 233 12/17/2023
2.2.0-nightly-049 130 12/23/2023
2.2.0-nightly-048 113 12/17/2023
2.2.0-nightly-042 139 9/23/2023
2.2.0-nightly-041 131 9/23/2023
2.2.0-nightly-039 120 9/23/2023
2.1.1 495 9/23/2023
2.1.1-nightly-038 161 9/16/2023
2.1.1-nightly-037 163 8/19/2023
2.1.0 227 8/11/2023
2.1.0-nightly-036 205 8/11/2023
2.1.0-nightly-035 200 5/20/2023
2.1.0-nightly-034 231 1/9/2023
2.1.0-nightly-033 209 12/2/2022
2.0.0 469 11/23/2022
2.0.0-nightly-028 208 11/3/2022
2.0.0-nightly-027 238 10/19/2022
2.0.0-nightly-026 206 10/9/2022
2.0.0-nightly-025 224 10/8/2022
2.0.0-nightly-023 238 9/25/2022
2.0.0-nightly-021 221 9/23/2022