Skip to content

OnixLabs.Core.Text.ReadOnlySpanExtensions

matthew edited this page May 27, 2026 · 1 revision

ReadOnlySpanExtensions Class

Provides extension methods for ReadOnlySpan<byte> instances, converting the underlying bytes into the corresponding Base value type.

Namespace OnixLabs.Core.Text
Assembly OnixLabs.Core.dll (NuGet)
Inheritance object → ReadOnlySpanExtensions

Definition

[EditorBrowsable(EditorBrowsableState.Never)]
public static class ReadOnlySpanExtensions

Note This class is decorated with [EditorBrowsable(EditorBrowsableState.Never)], which hides it from IntelliSense completion lists in some IDE configurations. The extension methods remain fully public and callable; they primarily support the Base value codecs throughout the library.

Remarks

ReadOnlySpanExtensions uses a C# 14 extension(ReadOnlySpan<byte> receiver) block to expose fluent conversion methods directly on byte spans. Each method wraps the span bytes into the corresponding Base value type without any intermediate allocations beyond the new struct or class instance.

Bring the methods into scope with:

using OnixLabs.Core.Text;

Methods

Method Returns Description
ToBase16() Base16 Converts the current byte span into a new Base16 instance.
ToBase32() Base32 Converts the current byte span into a new Base32 instance.
ToBase58() Base58 Converts the current byte span into a new Base58 instance.
ToBase64() Base64 Converts the current byte span into a new Base64 instance.

ToBase16()

public Base16 ToBase16()

Converts the current ReadOnlySpan<byte> into a new Base16 instance.

Returns — A new Base16 instance wrapping the bytes in the span.


ToBase32()

public Base32 ToBase32()

Converts the current ReadOnlySpan<byte> into a new Base32 instance.

Returns — A new Base32 instance wrapping the bytes in the span.


ToBase58()

public Base58 ToBase58()

Converts the current ReadOnlySpan<byte> into a new Base58 instance.

Returns — A new Base58 instance wrapping the bytes in the span.


ToBase64()

public Base64 ToBase64()

Converts the current ReadOnlySpan<byte> into a new Base64 instance.

Returns — A new Base64 instance wrapping the bytes in the span.

using OnixLabs.Core.Text;

ReadOnlySpan<byte> data = [ 0x01, 0x02, 0x03 ];

Base16 base16 = data.ToBase16();
Base32 base32 = data.ToBase32();
Base58 base58 = data.ToBase58();
Base64 base64 = data.ToBase64();

See Also

ONIXLabs .NET Library


Clone this wiki locally