RSCG – zlinq
name | zlinq |
nuget |
https://www.nuget.org/packages/ZLinq.DropInGenerator/ https://www.nuget.org/packages/ZLinq/ |
link | https://neuecc.medium.com/zlinq-a-zero-allocation-linq-library-for-net-1bb0a3e5c749 |
author | Cysharp – subsidiary of Cygames |
zero allocations for LINQ operations, high performance, functional programming
This is how you can use zlinq .
The code that you start with is
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net9.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <PackageReference Include="ZLinq" Version="1.4.8" /> <PackageReference Include="ZLinq.DropInGenerator" Version="1.4.8"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> </ItemGroup> <PropertyGroup> <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> <CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath> </PropertyGroup> </Project>
The code that you will use is
using ZLinq; // https://github.com/Cysharp/ZLinq Console.WriteLine("Hello, World!"); var x = Enumerable.Range(1, 10) .Select(x => x * 2) ; var y = x.ToArray(); foreach (var item in x) { Console.WriteLine(item); }
The code that is generated is
Code and pdf at
https://ignatandrei.github.io/RSCG_Examples/v2/docs/zlinq