TheChest.Inventories 0.16.0

dotnet add package TheChest.Inventories --version 0.16.0
                    
NuGet\Install-Package TheChest.Inventories -Version 0.16.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="TheChest.Inventories" Version="0.16.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TheChest.Inventories" Version="0.16.0" />
                    
Directory.Packages.props
<PackageReference Include="TheChest.Inventories" />
                    
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 TheChest.Inventories --version 0.16.0
                    
#r "nuget: TheChest.Inventories, 0.16.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 TheChest.Inventories@0.16.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=TheChest.Inventories&version=0.16.0
                    
Install as a Cake Addin
#tool nuget:?package=TheChest.Inventories&version=0.16.0
                    
Install as a Cake Tool

TheChest.Inventories

NuGet Version Coverage

TheChest.Inventories is a library for managing inventories and slots in generic item collections. It provides a flexible and extensible framework for inventory systems, with support for stackable items, customizable slots, and operations such as adding, removing, moving, and querying items.

Key features

  • Generic inventory support: works with generic item types for maximum flexibility.
  • Slot-based system: stores items in single-item or stackable slots.
  • Extensible interfaces: enables custom inventory implementations.
  • Core operations: add, remove, move, and retrieve items.
  • Stacking support: handles both simple inventories and stack-based inventories.

Project structure

Main components

  • Inventory<T>

    • Generic inventory implementation using single-item slots.
    • Uses InventorySlot<T> to represent each slot.
  • StackInventory<T>

    • Generic inventory for stackable items.
    • Uses InventoryStackSlot<T> to represent slots holding multiple units of the same item.
  • LazyStackInventory<T>

    • Stackable inventory with lazy item loading.
    • Uses InventoryLazyStackSlot<T> to represent slots that can return items on demand.

Installation

Via NuGet

Add the NuGet package source:

nuget source add -n TheChest https://nuget.pkg.github.com/The-Chest/index.json

Install the package:

nuget install TheChest.Inventories

Via DLL

You can also download the DLL directly and reference it in your project.

Usage examples

Simple inventory

var slots = new IInventorySlot<string>[10];
for (int i = 0; i < slots.Length; i++)
{
    slots[i] = new InventorySlot<string>();
}

var inventory = new Inventory<string>(slots);
inventory.Add("Item1");

StackInventory

var stackSlots = new IInventoryStackSlot<string>[10];
for (int i = 0; i < stackSlots.Length; i++)
{
    stackSlots[i] = new InventoryStackSlot<string>(Array.Empty<string>(), 5);
}

var stackInventory = new StackInventory<string>(stackSlots);
stackInventory.Add("StackableItem", "StackableItem");

LazyStackInventory

var lazyStackSlots = new IInventoryLazyStackSlot<string>[10];
for (int i = 0; i < lazyStackSlots.Length; i++)
{
    lazyStackSlots[i] = new InventoryLazyStackSlot<string>($"item_{i}_", 5, 2);
}

var lazyStackInventory = new LazyStackInventory<string>(lazyStackSlots);
lazyStackInventory.Add("StackableItem", "StackableItem");

Additional documentation

More usage and extension details are available in the docs/ folder.

Future plans

Future version plans are available on the GitHub Project Board.

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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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.

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
0.16.0 48 5/22/2026
0.15.0 103 4/22/2026
0.14.0 120 2/14/2026
0.13.0 116 1/19/2026
0.12.4 123 1/18/2026
0.12.3 113 1/18/2026
0.12.2 195 12/5/2025
0.12.1 302 11/11/2025
0.12.0 206 10/24/2025
0.11.1 241 9/21/2025
0.11.0 250 9/19/2025
0.10.1 323 9/17/2025
0.10.0 321 9/17/2025
0.9.0 181 8/17/2025
0.8.1 284 8/8/2025 0.8.1 is deprecated because it is no longer maintained.
0.8.0 295 8/8/2025 0.8.0 is deprecated because it is no longer maintained.
0.7.1 352 8/7/2025 0.7.1 is deprecated because it is no longer maintained.
0.7.0 211 6/27/2025 0.7.0 is deprecated because it is no longer maintained.
0.6.0 247 6/7/2025 0.6.0 is deprecated because it is no longer maintained.
0.5.0 243 6/7/2025 0.5.0 is deprecated because it is no longer maintained.
Loading failed

See CHANGELOG.md for details.