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 128 12/30/2024
3.0.0-nightly-077 94 12/30/2024
2.3.3-nightly-076 101 10/22/2024
2.3.3-nightly-075 121 5/25/2024
2.3.2 164 5/25/2024
2.3.1 149 5/25/2024
2.3.0 154 5/24/2024
2.3.0-nightly-070 112 5/24/2024
2.3.0-nightly-069 123 5/24/2024
2.3.0-nightly-068 122 5/24/2024
2.3.0-nightly-067 121 5/24/2024
2.3.0-nightly-066 126 5/24/2024
2.3.0-nightly-065 115 5/23/2024
2.3.0-nightly-064 119 5/23/2024
2.3.0-nightly-062 122 5/16/2024
2.2.2-nightly-059 120 4/16/2024
2.2.2-nightly-058 125 4/10/2024
2.2.2-nightly-057 127 4/9/2024
2.2.2-nightly-056 128 4/4/2024
2.2.1 196 3/21/2024
2.2.1-nightly-054 97 3/21/2024
2.2.1-nightly-053 114 3/20/2024
2.2.1-nightly-051 108 3/16/2024
2.2.0 239 12/17/2023
2.2.0-nightly-049 134 12/23/2023
2.2.0-nightly-048 117 12/17/2023
2.2.0-nightly-042 143 9/23/2023
2.2.0-nightly-041 136 9/23/2023
2.2.0-nightly-039 124 9/23/2023
2.1.1 500 9/23/2023
2.1.1-nightly-038 165 9/16/2023
2.1.1-nightly-037 169 8/19/2023
2.1.0 233 8/11/2023
2.1.0-nightly-036 211 8/11/2023
2.1.0-nightly-035 207 5/20/2023
2.1.0-nightly-034 238 1/9/2023
2.1.0-nightly-033 216 12/2/2022
2.0.0 476 11/23/2022
2.0.0-nightly-028 215 11/3/2022
2.0.0-nightly-027 245 10/19/2022
2.0.0-nightly-026 213 10/9/2022
2.0.0-nightly-025 231 10/8/2022
2.0.0-nightly-023 245 9/25/2022
2.0.0-nightly-021 228 9/23/2022