![]() |
VOOZH | about |
dotnet add package IEnumerableUnpacker --version 1.0.3
NuGet\Install-Package IEnumerableUnpacker -Version 1.0.3
<PackageReference Include="IEnumerableUnpacker" Version="1.0.3" />
<PackageVersion Include="IEnumerableUnpacker" Version="1.0.3" />Directory.Packages.props
<PackageReference Include="IEnumerableUnpacker" />Project file
paket add IEnumerableUnpacker --version 1.0.3
#r "nuget: IEnumerableUnpacker, 1.0.3"
#:package IEnumerableUnpacker@1.0.3
#addin nuget:?package=IEnumerableUnpacker&version=1.0.3Install as a Cake Addin
#tool nuget:?package=IEnumerableUnpacker&version=1.0.3Install as a Cake Tool
👁 alternate text is missing from this package README image
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. 🚀
IEnumerable<T> to 1D and 2D arrays of T's membersYou can install IEnumerableUnpacker via NuGet Package Manager:
Install-Package IEnumerableUnpacker
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:
Unpackable attribute is used to mark the class for unpacking.Unpack attribute is used to specify the output parameter names for the unpacked arrays.Unpack attribute will not be unpacked.For more detailed benchmarks and comparisons, please visit the project repository. 📊
Benchmarks and template for generated source is aviable in Benchmark repository
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. 😊
IEnumerableUnpacker is licensed under the MIT License.
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! 📫
Learn more about Target Frameworks and .NET Standard.
Showing the top 1 NuGet packages that depend on IEnumerableUnpacker:
| Package | Downloads |
|---|---|
|
RLMatrix
Deep Reinforcement Learning in .NET |
Showing the top 1 popular GitHub repositories that depend on IEnumerableUnpacker:
| Repository | Stars |
|---|---|
|
asieradzk/RL_Matrix
Deep Reinforcement Learning in C#
|