PoolingLib 1.0.2

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

PoolingLib

📖 English

Overview

PoolingLib is a lightweight object pooling library for .NET, reusing common objects to reduce memory allocations.

  • Get() retrieves an object from the pool (creates if empty).
  • Release() returns the object back to the pool.

📦 Supported Types

Pool Type Base
ListPool<T> List<T>
HashSetPool<T> HashSet<T>
DictionaryPool<TKey, TValue> Dictionary<TKey, TValue>
QueuePool<T> Queue<T>
StackPool<T> Stack<T>
StringBuilderPool StringBuilder
MemoryStreamPool MemoryStream
SortedSetPool<T> SortedSet<T>
SortedDictionaryPool<TKey, TValue> SortedDictionary<TKey, TValue>

Usage Example

// Get a pooled List<int>
var list = ListPool<int>.Pool.Get();

list.Add(1);
list.Add(4);
list.Remove(1);

Console.WriteLine(list.Count);   // Output: 1

// Return the list to the pool
ListPool<int>.Pool.Release(list);

📖 中文

简述

PoolingLib 是一个用于.NET的轻量级对象池库,通过复用对象来减少内存分配。

  • Get() 从池中获取一个对象 (如果为空则创建)。
  • Release() 将对象返回至对象池。

📦 支持的类型

池类型 基础类型
ListPool<T> List<T>
HashSetPool<T> HashSet<T>
DictionaryPool<TKey, TValue> Dictionary<TKey, TValue>
QueuePool<T> Queue<T>
StackPool<T> Stack<T>
StringBuilderPool StringBuilder
MemoryStreamPool MemoryStream
SortedSetPool<T> SortedSet<T>
SortedDictionaryPool<TKey, TValue> SortedDictionary<TKey, TValue>

使用示例

// 获取一个池化过的List<int>
var list = ListPool<int>.Pool.Get();

list.Add(1);
list.Add(4);
list.Remove(1);

Console.WriteLine(list.Count);   // 输出: 1

// 将List<int>返回至列表
ListPool<int>.Pool.Release(list);
Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on PoolingLib:

Package Downloads
MengXinSheQu.Library

用于萌新社区服务器插件的拓展库

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.3 167 3/31/2026
1.0.2 110 3/26/2026