Hertzole.ArrayPoolScope 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Hertzole.ArrayPoolScope --version 1.0.0                
NuGet\Install-Package Hertzole.ArrayPoolScope -Version 1.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="Hertzole.ArrayPoolScope" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Hertzole.ArrayPoolScope --version 1.0.0                
#r "nuget: Hertzole.ArrayPoolScope, 1.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.
// Install Hertzole.ArrayPoolScope as a Cake Addin
#addin nuget:?package=Hertzole.ArrayPoolScope&version=1.0.0

// Install Hertzole.ArrayPoolScope as a Cake Tool
#tool nuget:?package=Hertzole.ArrayPoolScope&version=1.0.0                

Array Pool Scope

Array Pool Scope allows you to use ArrayPool in a scope-like manner.

💨 Quick Start

using Hertzole.Buffers;

int length = 10;
// Use a using statement to automatically return the array to the pool.
using (ArrayPoolScope<int> pool = new ArrayPoolScope<int>(length))
{
    // For loop
    for (int i = 0; i < pool.Length; i++)
    {
        pool.Array[i] = i;
        Console.WriteLine(pool.Array[i]);
    }

    // Foreach loop
    foreach (int item in pool)
    {
        Console.WriteLine(item);
    }
}

// Manully return the array to the pool.
ArrayPoolScope<int> pool = new ArrayPoolScope<int>(length);
pool.Dispose();

// Provide your own pool.
ArrayPool<int> customPool = ArrayPool<int>.Create();
using ArrayPoolScope<int> pool = new ArrayPoolScope<int>(length, customPool);

// Get directly from pool
using ArrayPoolScope<int> pool = ArrayPool<int>.RentScope(length);

// As span and memory
using ArrayPoolScope<int> pool = ArrayPool<int>.RentScope(length);
Span<int> span = pool.AsSpan();
Memory<int> memory = pool.AsMemory();

📦 Installation

You can install the package via NuGet. The package supports .NET Standard 2.0 and up.

dotnet add package Hertzole.ArrayPoolScope

Unity Installation

The minimum Unity version for Array Pool Scope is 2021.3.

You can install the package through OpenUPM by using the OpenUPM CLI.

openupm add se.hertzole.array-pool-scope

If you don't have the CLI installed, you can follow these steps:

  1. Open Edit/Project Settings/Package Manager
  2. Add a new Scoped Registry (or edit the existing OpenUPM entry)
    Name: package.openupm.com
    URL: https://package.openupm.com
    Scope: se.hertzole.array-pool-scope
  3. Click Save (or Apply)
  4. Open Window/Package Manager
  5. Click +
  6. Select Add package by name... or Add package from git URL...
  7. Paste se.hertzole.array-pool-scope into name
  8. Click Add
Unity Package Manager

You can install the package through the Unity Package Manager.

  1. Open Window/Package Manager
  2. Click the + in the top left corner
  3. Select Add package from git URL...
  4. Paste https://github.com/Hertzole/array-pool-scope.git#upm

💻 Development

Requirements

For standard .NET development, you need the following:

For Unity development, you need the following:

Building

To build the project, you can use the dotnet CLI.

dotnet build

Testing

To run the tests, you can use the dotnet CLI.

dotnet test

Unity

The main SDK should be the "single source of truth". This means that all code should be written in the main project and then copied over to the Unity project.

To open the project in Unity, you need to open the Unity folder as a project.

🤝 Contributing

Contributions, issues and feature requests are welcome!

Please make sure your pull requests are made to the develop branch and that you have tested your changes. If you're adding a new feature, please also add tests for it.

Your code should follow the C# Coding Conventions. Your commits should follow the Conventional Commits standard.

📃 License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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 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. 
.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 is compatible. 
.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

  • .NETStandard 2.1

    • No dependencies.
  • net5.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.

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
2.2.1 106 10/28/2024
2.1.0 84 10/25/2024
2.0.1 150 10/18/2024
2.0.0 108 9/24/2024
1.1.0 158 8/11/2024
1.0.0 84 7/23/2024