TheChest.Core 0.17.2

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

The Chest Core

NuGet Version Coverage

The Chest Core is a lightweight and extensible library for creating containers, slots, and inventory-like data structures. It provides abstractions and ready-to-use base implementations, allowing to build storage systems.

How does it work

The library revolves around the concepts of Container and Slot. A Container holds multiple Slot objects, and each Slot can store an item. The library provides base implementations and interfaces to simplify the creation of custom containers and slots.

How to use it

Quick Start

using TheChest.Core.Containers;
using TheChest.Core.Slots;

var slots = new ISlot<int>[]
{
    new Slot<int>(0),
    new Slot<int>(0),
    new Slot<int>(5)
};

var container = new Container<int>(slots);

Installation

NuGet

To install the library via Nuget, you can use the following command:

dotnet add package TheChest.Core
DLL

Alternatively, you can download the DLL file and reference it directly in your project.

Usage

Extending the classes

The library provides ready-to-use implementations such as Container<T> and Slot<T>. These can be used directly or extended to add custom behavior. For example:

using TheChest.Core.Containers;

public class MyContainer : Container<int>
{
    public MyContainer(ISlot<int>[] items) : base(items)
    {
        if (items.Length != 10)
            throw new System.ArgumentException("Invalid container size");
    }

    public override int Size
    {
        get
        {
            return 10;
        }
    }
}

using TheChest.Core.Slots;

public class CustomSlot : Slot<string>
{
    public CustomSlot(string item) : base(item)
    {
    }

    public override bool IsEmpty => this.content == null;

    public override bool IsFull => this.content != null;
}
Implementing interfaces

If you need more control, you can implement the interfaces directly. For example:

using TheChest.Core.Containers.Interfaces;
using TheChest.Core.Slots.Interfaces;

public class MyContainer : IContainer<int>
{
    private readonly ISlot<int>[] slots; 

    public int Size { get; }

    public bool IsFull { get; }

    public bool IsEmpty { get; }

    public MyContainer(ISlot<int>[] slots)
    {
        if (slots.Length != 10)
            throw new System.ArgumentException("Invalid container size");
        this.slots = slots ?? throw new ArgumentNullException(nameof(slots));
    }
}

using TheChest.Core.Slots.Interfaces;

public class CustomSlot : ISlot<int>
{
    protected int? content;

    public bool IsEmpty => content == 0;

    public bool IsFull => content != 0;

    public CustomSlot(int? item)
    {
        content = item;
    }
}

Future Plans

The plans for future versions of The Chest Core are in this GitHub Project Board, with insights into upcoming features, improvements, and release timelines.

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.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on TheChest.Core:

Package Downloads
TheChest.Inventories

Provides generic collections to inventory management systems.

GitHub repositories

This package is not used by any popular GitHub repositories.

See CHANGELOG.md for details.