PoolingLib 1.0.3

dotnet add package PoolingLib --version 1.0.3
                    
NuGet\Install-Package PoolingLib -Version 1.0.3
                    
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.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PoolingLib" Version="1.0.3" />
                    
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.3
                    
#r "nuget: PoolingLib, 1.0.3"
                    
#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.3
                    
#: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.3
                    
Install as a Cake Addin
#tool nuget:?package=PoolingLib&version=1.0.3
                    
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).
  • Return() 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.Return(list);

📖 中文

简述

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

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

📦 支持的类型

池类型 基础类型
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.Return(list);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • 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 166 3/31/2026
1.0.2 110 3/26/2026