Converter.NumberSystem 1.0.0

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

Converter.NumberSystem

A lightweight .NET library for converting numbers between different numeral systems with built-in validation.

Features

  • Convert between:

    • Binary (Base 2)
    • Octal (Base 8)
    • Decimal (Base 10)
    • Hexadecimal (Base 16)
  • Automatic input validation.

  • Clean object-oriented design.

  • Extensible architecture based on abstract classes.

  • Simple and intuitive API.


Package Information

Property Value
Package Name Converter.NumberSystem
Author Mouatez Abderraouf A.
Company Metigator
License MIT
Description Convert between numbers from different bases.

Installation

dotnet add package Converter.NumberSystem

Quick Start

using Metigator.NumberSystem;
using Metigator.NumberSystem.Models;

public class Program
{
    public static void Main(string[] args)
    {
        var dec = new DecimalSystem("10");

        var bin = dec.To(NumberBase.BINARY);
        var oct = dec.To(NumberBase.OCTAL);
        var hex = dec.To(NumberBase.HEXADECIMAL);

        Console.WriteLine($"({dec.Value})10 = ({bin}){(int)NumberBase.BINARY}");
        Console.WriteLine($"({dec.Value})10 = ({oct}){(int)NumberBase.OCTAL}");
        Console.WriteLine($"({dec.Value})10 = ({hex}){(int)NumberBase.HEXADECIMAL}");

        Console.ReadKey();
    }
}

Output

(10)10 = (1010)2
(10)10 = (12)8
(10)10 = (A)16

Creating Number Objects

The library provides dedicated classes for each supported numeral system.

var binary = new BinarySystem("1010");
var octal = new OctalSystem("12");
var decimalNumber = new DecimalSystem("10");
var hexadecimal = new HexadecimalSystem("A");

Validation

Every number is validated when the object is created.

Valid example:

var binary = new BinarySystem("1010");

Invalid example:

var binary = new BinarySystem("1020");

The library will throw an exception because the value contains digits that are not valid in the binary numeral system.


Conversion

Convert any supported number system to another using the To() method.

var binary = new BinarySystem("1010");

string decimalValue = binary.To(NumberBase.DECIMAL);
string octalValue = binary.To(NumberBase.OCTAL);
string hexadecimalValue = binary.To(NumberBase.HEXADECIMAL);

Supported Number Systems

Number System Base
Binary 2
Octal 8
Decimal 10
Hexadecimal 16

Architecture

The library is built around an abstract base class that represents a numeral system.

Each implementation provides:

  • Its base value.
  • Validation rules.
  • Conversion support.

Current implementations:

BinarySystem
OctalSystem
DecimalSystem
HexadecimalSystem

This design makes it easy to add support for additional numeral systems in future versions.


Example Conversions

Input Source Base Target Base Result
10 Decimal Binary 1010
10 Decimal Octal 12
10 Decimal Hexadecimal A
1010 Binary Decimal 10
FF Hexadecimal Decimal 255

Requirements

  • .NET 8.0 or later

License

This project is licensed under the MIT License.


Author

Mouatez Abderraouf A.

Developed and maintained by Metigator.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.
  • net8.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 116 6/4/2026