IEnumerableUnpacker 1.0.1

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

// Install IEnumerableUnpacker as a Cake Tool
#tool nuget:?package=IEnumerableUnpacker&version=1.0.1                

IEnumerableUnpacker 📦

alternate text is missing from this package README image

License NuGet

IEnumerableUnpacker is a C# library that provides a quick and efficient way to unpack IEnumerable<T> to 1D and 2D arrays of T's members. It leverages parallel processing and optimized memory copying techniques to achieve high-performance array unpacking. 🚀

Key Features

  • Unpack IEnumerable<T> to 1D and 2D arrays of T's members
  • Utilize parallel processing for individual members âš¡
  • Identify blittable types and use unaligned memory copy for optimized performance
  • Support for generic types
  • Flexible attribute-based configuration for specifying output parameter names

Installation

You can install IEnumerableUnpacker via NuGet Package Manager:

Install-Package IEnumerableUnpacker

Usage

Here's an example of how to use IEnumerableUnpacker:

[Unpackable]
public class UnpackMe<Titem, Titem2, UselessGeneric>
{
    [Unpack("MyItegersOut")]
    public int[] myIntegers;

    [Unpack("MyIntegerOut")]
    public int myInteger;

    [Unpack("MyFloatsOut")]
    public float[] myFloats;

    [Unpack("MyGenericOut")]
    public Titem[] myGeneric;

    [Unpack("MyGeneric2Out")]
    public Titem2 myGeneric2;
}

public static unsafe void UnpackUnpackMe<Titem, Titem2, UselessGeneric>(this IEnumerable<UnpackMe<Titem, Titem2, UselessGeneric>> source, out int[,] MyItegersOut, out int[] MyIntegerOut, out float[,] MyFloatsOut, out Titem[,] MyGenericOut, out Titem2[] MyGeneric2Out)
{
    // Unpacking logic...
}

In this example:

  • The Unpackable attribute is used to mark the class for unpacking.
  • The Unpack attribute is used to specify the output parameter names for the unpacked arrays.
  • Generic types are supported and can be used as needed.
  • Parameters not labeled with the Unpack attribute will not be unpacked.

For more detailed benchmarks and comparisons, please visit the project repository. 📊

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository. 😊

License

ArrayUnpacker is licensed under the MIT License.

Note

I've decided to use 2D arrays because that's what I use with TorchSharp. Unpacking to flat types might be faster, so feel free to reach out to me if it's required! 📫

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. 
.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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on IEnumerableUnpacker:

Package Downloads
RLMatrix

Deep Reinforcement Learning in .NET

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on IEnumerableUnpacker:

Repository Stars
asieradzk/RL_Matrix
Deep Reinforcement Learning in C#
Version Downloads Last updated
1.0.3 6,028 5/27/2024
1.0.2 106 5/27/2024
1.0.1 107 5/27/2024
1.0.0 109 5/27/2024