Tree3.Converter 3.0.0

dotnet add package Tree3.Converter --version 3.0.0
                    
NuGet\Install-Package Tree3.Converter -Version 3.0.0
                    
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="Tree3.Converter" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tree3.Converter" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Tree3.Converter" />
                    
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 Tree3.Converter --version 3.0.0
                    
#r "nuget: Tree3.Converter, 3.0.0"
                    
#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 Tree3.Converter@3.0.0
                    
#: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=Tree3.Converter&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Tree3.Converter&version=3.0.0
                    
Install as a Cake Tool

Tree3.Converter

Tree3.Converter is a lightweight .NET library for converting between binary, decimal, octal and hexadecimal, supporting arbitrarily large numbers, input validation, and reusable utility methods.


Features

  • Asynchronous API � all operations return Task<string>, ready for use in async workflows.
  • Arbitrary-precision integer support � operands are passed as strings, enabling conversion with values larger than long limits.
  • Simple, extensible interface � easy to implement with any numeric backend (e.g., BigInteger, external converter service, or distributed engine).
  • Consistent method naming � unified API for converting between binary, decimal, octal and hexadecimal numbers.
  • Serialization-friendly � string inputs/outputs integrate seamlessly with JSON APIs and network-based systems.
  • Testable and mockable � ideal for dependency injection and unit testing scenarios.
  • Cross-platform � built for .NET 10.0, works on Windows, Linux, and macOS.

Usage

using Tree3.Converter;

// All public interfaces and classes are in the Tree3.Converter namespace
ICustomBase64Converter
    Task<string> ToDecimalAsync(string number);

IBinaryConverter
	Task<string> ToDecimalAsync(string number);
	Task<string> ToOctalAsync(string number);
	Task<string> ToHexadecimalAsync(string number);

IConverterUtilities
	string RemoveLeadingZeros(string number);
	(bool, BigInteger) ParseDecimalToBigInteger(string number);
	(bool, BigInteger) ParseHexadecimalToBigInteger(string number);
	bool IsValidBinary(string number);
	bool IsValidDecimal(string number);
	bool IsValidOctal(string number);
	bool IsValidHexadecimal(string number);
	bool IsValidCustomBase64(string number);
	
IDecimalConverter
	Task<string> ToBinaryAsync(string number);
	Task<string> ToOctalAsync(string number);
	Task<string> ToHexadecimalAsync(string number);

IHexadecimalConverter
	Task<string> ToBinaryAsync(string number);
	Task<string> ToDecimalAsync(string number);
	Task<string> ToOctalAsync(string number);

IOctalConverter
	Task<string> ToBinaryAsync(string number);
	Task<string> ToDecimalAsync(string number);
	Task<string> ToHexadecimalAsync(string number);

// Custom Base64 Mapping Table
// Index:  0-9  => '0'-'9'
// Index:  10-35  => 'A'-'Z'
// Index:  36-61  => 'a'-'z'
// Index:     62  => '-'
// Index:     63  => '_'

Performance

NET 10 / Windows 11 / Intel i5 CPU

  • Converts a binary number with 100,000 digits to decimal in ~0.5 seconds.

  • Converts a binary number with 100,000 digits to octal in ~0.004 seconds.

  • Converts a binary number with 100,000 digits to hexadecimal in ~0.6 seconds.

  • Converts a decimal number with 100,000 digits to binary in ~7 seconds on.

  • Converts a decimal number with 100,000 digits to octal in ~7 seconds on.

  • Converts a decimal number with 100,000 digits to hexadecimal in ~0.01 seconds on.

  • Converts a octal number with 100,000 digits to binary in ~0.01 seconds on.

  • Converts a octal number with 100,000 digits to decimal in ~5 seconds on.

  • Converts a octal number with 100,000 digits to hexadecimal in ~4.9 seconds on.

  • Converts a hexadecimal number with 100,000 digits to binary in ~10 seconds on.

  • Converts a hexadecimal number with 100,000 digits to decimal in ~1 seconds on.

  • Converts a hexadecimal number with 100,000 digits to octal in ~10 seconds on.

  • Converts a decimal number with 100,000 digits to base64 number in ~8 seconds on.

  • Converts a base64 number with 100,000 digits to decimal in ~4 seconds on.


Release Notes

v3.0.0 � 2025-11-30

  • Migrated to .NET 10.0.
  • Added ICustomBase64Converter, IConverterUtilities
  • New functionalities:
    • IDecimalConverter :
      • Task<string> ToBase64Async(string number);
    • ICustomBase64Converter :
      • Task<string> ToDecimalAsync(string number);
    • IConverterUtilities :
      • string RemoveLeadingZeros(string number);
      • (bool, BigInteger) ParseDecimalToBigInteger(string number);
      • (bool, BigInteger) ParseHexadecimalToBigInteger(string number);
      • bool IsValidBinary(string number);
      • bool IsValidDecimal(string number);
      • bool IsValidOctal(string number);
      • bool IsValidHexadecimal(string number);
      • bool IsValidCustomBase64(string number);

v2.0.0 � 2025-11-14

  • Added IBinaryConverter, IDecimalConverter, IOctalConverter, IHexadecimalConverter interfaces for asynchronous non-negative integer conversion.
  • Supported operations:
    • IBinaryConverter :
      • ToDecimalAsync(string number)
      • ToOctalAsync(string number)
      • ToHexadecimalAsync(string number)
    • IDecimalConverter :
      • ToBinaryAsync(string number)
      • ToOctalAsync(string number)
      • ToHexadecimalAsync(string number)
    • IOctalConverter :
      • ToBinaryAsync(string number)
      • ToDecimalAsync(string number)
      • ToHexadecimalAsync(string number)
    • IHexadecimalConverter :
      • ToBinaryAsync(string number)
      • ToDecimalAsync(string number)
      • ToOctalAsync(string number)
  • All methods return results as string values, allowing support for very large numbers.
  • Compatible with .NET 9.0.
  • Designed for extensibility and dependency injection.

v1.1.0

  • Refactored converter logic for performance and readability.
  • Enhanced validation for decimal and binary inputs.
  • Made all converter and validator classes static.
  • Added reusable Utilities classes.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Tree3.Converter:

Package Downloads
Tree3.Calculator

Performs addition, subtraction, multiplication, division, and modulo operations on arbitrarily large non-negative integers represented as strings.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0 367 11/30/2025
2.0.0 189 11/15/2025
1.1.0 227 11/5/2025
1.0.2 212 11/4/2025
1.0.1 215 11/3/2025
1.0.0 205 11/3/2025

- Migrated to **.NET 10.0**.
     - Added `ICustomBase64Converter, IConverterUtilities`
     - New functionalities:
     - `IDecimalConverter` :
     - `Task string ToBase64Async(string number);`
     - `ICustomBase64Converter` :
     - `Task string ToDecimalAsync(string number);`
     - `IConverterUtilities` :
     - `string RemoveLeadingZeros(string number);`
     - `(bool, BigInteger) ParseDecimalToBigInteger(string number);`
     - `(bool, BigInteger) ParseHexadecimalToBigInteger(string number);`
     - `bool IsValidBinary(string number);`
     - `bool IsValidDecimal(string number);`
     - `bool IsValidOctal(string number);`
     - `bool IsValidHexadecimal(string number);`
     - `bool IsValidCustomBase64(string number);`
     - Custom Base64 Mapping:      
     - Index:  0-9  => '0'-'9'
     - Index:  10-35  => 'A'-'Z'
     - Index:  36-61  => 'a'-'z'
     - Index:     62  => '-'
     - Index:     63  => '_'