Zomp.SyncMethodGenerator 0.1.37-alpha

This is a prerelease version of Zomp.SyncMethodGenerator.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Zomp.SyncMethodGenerator --version 0.1.37-alpha
                    
NuGet\Install-Package Zomp.SyncMethodGenerator -Version 0.1.37-alpha
                    
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="Zomp.SyncMethodGenerator" Version="0.1.37-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Zomp.SyncMethodGenerator" Version="0.1.37-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Zomp.SyncMethodGenerator" />
                    
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 Zomp.SyncMethodGenerator --version 0.1.37-alpha
                    
#r "nuget: Zomp.SyncMethodGenerator, 0.1.37-alpha"
                    
#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 Zomp.SyncMethodGenerator@0.1.37-alpha
                    
#: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=Zomp.SyncMethodGenerator&version=0.1.37-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Zomp.SyncMethodGenerator&version=0.1.37-alpha&prerelease
                    
Install as a Cake Tool

Sync Method Generator

Build Support .NET Standard 2.0 Nuget

This .NET source generator produces a sync method from an async one.

Use cases

  • A library which exposes both sync and async version of a method
  • An application has to process two kinds of data in the same way:
    • Large data from I/O which cannot be stored in memory before processing: Original async method
    • Small sample of data in memory, usually a sample of the larger data: Generated sync method

How it works

Add CreateSyncVersionAttribute to your async method in your partial class

[Zomp.SyncMethodGenerator.CreateSyncVersion]
static async Task WriteAsync(ReadOnlyMemory<byte> buffer, Stream stream, 
CancellationToken ct)
    => await stream.WriteAsync(buffer, ct).ConfigureAwait(true);

And it will generate a sync version of the method:

static void Write(ReadOnlySpan<byte> buffer, Stream stream)
    => stream.Write(buffer);

A list of changes applied to the new synchronized method:

Installation

To add the library use:

dotnet add package Zomp.SyncMethodGenerator
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (4)

Showing the top 4 popular GitHub repositories that depend on Zomp.SyncMethodGenerator:

Repository Stars
FluentValidation/FluentValidation
A popular .NET validation library for building strongly-typed validation rules.
mini-software/MiniExcel
Fast, Low-Memory, Easy Excel .NET helper to import/export/template spreadsheet (support Linux, Mac)
Zeugma440/atldotnet
Fully managed, portable and easy-to-use C# library to read and edit audio data and metadata (tags) from various audio formats, playlists and CUE sheets
BigBang1112/gbx-net
General purpose library for Gbx files - data from Nadeo games like Trackmania or Shootmania, written in C#/.NET. It supports high performance serialization and deserialization of 400+ Gbx classes.
Version Downloads Last Updated
2.0.7 2,097 12/24/2025
2.0.5 432 12/15/2025
2.0.4 323 11/27/2025
2.0.3 217 11/27/2025
2.0.2 201 11/24/2025
2.0.1 202 11/24/2025
1.6.17 1,348 7/28/2025
1.6.16 169 7/28/2025
1.6.15 268 7/28/2025 1.6.15 is deprecated because it has critical bugs.
1.6.14 197 7/27/2025
1.6.13 508 7/27/2025
1.6.12 284 7/26/2025
1.6.11 556 7/24/2025
1.6.10 951 7/24/2025
1.6.9 619 7/23/2025
1.6.8 404 7/20/2025
1.6.3 230 7/17/2025
1.6.2 1,331 7/8/2025
1.6.1 208 7/8/2025
0.1.37-alpha 365 1/19/2023
Loading failed