cs-varint 1.0.0

Install-Package cs-varint -Version 1.0.0
dotnet add package cs-varint --version 1.0.0
<PackageReference Include="cs-varint" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add cs-varint --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: cs-varint, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install cs-varint as a Cake Addin
#addin nuget:?package=cs-varint&version=1.0.0

// Install cs-varint as a Cake Tool
#tool nuget:?package=cs-varint&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


license standard-readme compliant

This is a C# .NET Core port of the repository https://github.com/multiformats/go-varint

Varint helpers that enforce minimal encoding.

The purpose of this port is to support future efforts to port go-libp2p to the C# language.


This is a C# class library. You may include it in any project by referencing using the dotnet CLI too, such as:

dotnet add reference ./VarInt/VarInt.csproj

Or simply by using the NuGet package manager, like:

dotnet add package cs-varint


To convert to or from variable binary encoded UInt64 values, use the VarInt static class methods.

var into = VarInt.ToUVarInt(i);
var back = VarInt.FromUVarInt(into);

This is a library that is to be used by a project which includes it.

Method signatures are generally preserved as-is from the source library go-varint, with these notable deviations:

  1. Uvarint is renamed UVarInt to match .NET standard naming conventions, such as seeen in BigInt
  2. Errors are not returned as objects in a tuple; they are thrown as C# exceptions, so callers will need to use try/catch (common in .NET) instead of return value checking (common in Go)


PRs accepted.

Small note: If editing the Readme, please conform to the standard-readme specification.


MIT © Sean McElroy

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

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 107 8/13/2021

Initial version