Skip to content

IConverter

IConverter defines the conversion contract implemented by all base-N converters in this library. It exists so that calling code (via the BaseNConverter extension methods) can operate against any base without knowing the concrete converter type.

Purpose

  • Declare the members every base-N converter must provide: its numeric base, alpha↔numeric digit conversion, and array-to-string formatting.

Context

  • Namespace: SAIF.Framework.BaseN
  • Assembly/package: SAIF.Framework.BaseN (also bundled into the SAIF.BOF.Framework NuGet package)

Public members

Member Signature Purpose
Base ReadOnly Property Base() As Integer Returns the numeric base (radix) of the converter (e.g., 2, 8, 16, 26).
ConvertNumericToAlpha Function ConvertNumericToAlpha(ByVal input As Integer) As String Converts a single numeric digit value to its alpha (string) representation.
ConvertAlphaToNumeric Function ConvertAlphaToNumeric(ByVal input As String) As Integer Converts a single alpha/numeric character to its numeric digit value.
FormatBaseN Function FormatBaseN(ByVal values As Integer()) As String Renders an array of numeric digit values as a final BaseN string.

Behavioral notes

  • Implementations are expected to be stateless; Base is read-only, so a converter represents a single, fixed numeric base for its lifetime.*
  • BinaryConverter, OctalConverter, HexConverter, and ExcelConverter are the four concrete implementations shipped in this library; ConverterBase provides a reusable default implementation for most members.

Constraints and usage notes

  • Callers typically do not invoke IConverter members directly; the BaseNConverter extension methods (BaseNToDecimal, DecimalToBaseN) orchestrate calls into an IConverter instance on the caller's behalf.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified. Statements marked with † were retrieved from dependency library documentation via the Legends CLI RAG service. They describe inherited behavior from the indicated origin library and should be verified if the dependency version changes.

Sources

  • SAIF.Framework.BaseN\IConverter.vb