Skip to content

OnixLabs.Core.Text.IBaseValue T

matthew edited this page May 27, 2026 · 1 revision

IBaseValue<T> Interface

Defines a generic base encoding representation.

Namespace OnixLabs.Core.Text
Assembly OnixLabs.Core.dll (NuGet)
Implements IValueEquatable<T>, ISpanParsable<T>, IBaseValue

Definition

public interface IBaseValue<T> : IValueEquatable<T>, ISpanParsable<T>, IBaseValue
    where T : struct, IBaseValue<T>

Type Parameters

Parameter Description
T The underlying value type implementing the base encoding representation. The constraint where T : struct, IBaseValue<T> is the curiously recurring template pattern, restricting T to a value type that implements this interface in terms of itself.

Remarks

IBaseValue<T> is the strongly typed contract implemented by the concrete Base-N value structs (Base16, Base32, Base58, and Base64). In addition to value equality (via IValueEquatable<T>), span parsing (via ISpanParsable<T>), and the formatting members inherited from IBaseValue, it declares a family of static abstract implicit conversion operators. These allow any byte- or character-based buffer — a span, memory, or buffer sequence — to be converted into a T instance without an explicit cast. The character-based conversions use the default Encoding.

Operators

Operator Description
implicit operator T(ReadOnlySpan<byte>) Converts a byte span into a new T instance.
implicit operator T(ReadOnlyMemory<byte>) Converts a byte memory region into a new T instance.
implicit operator T(ReadOnlySequence<byte>) Converts a byte buffer sequence into a new T instance.
implicit operator T(ReadOnlySpan<char>) Converts a character span into a new T instance using the default Encoding.
implicit operator T(ReadOnlyMemory<char>) Converts a character memory region into a new T instance using the default Encoding.
implicit operator T(ReadOnlySequence<char>) Converts a character buffer sequence into a new T instance using the default Encoding.

implicit operator T(ReadOnlySpan<byte>)

public static abstract implicit operator T(ReadOnlySpan<byte> value);

Implicitly converts the specified ReadOnlySpan<byte> into a new T instance.

Parameter Type Description
value ReadOnlySpan<byte> The value to convert.

Returns — A new T instance converted from value.

implicit operator T(ReadOnlyMemory<byte>)

public static abstract implicit operator T(ReadOnlyMemory<byte> value);

Implicitly converts the specified ReadOnlyMemory<byte> into a new T instance.

Parameter Type Description
value ReadOnlyMemory<byte> The value to convert.

Returns — A new T instance converted from value.

implicit operator T(ReadOnlySequence<byte>)

public static abstract implicit operator T(ReadOnlySequence<byte> value);

Implicitly converts the specified ReadOnlySequence<byte> into a new T instance.

Parameter Type Description
value ReadOnlySequence<byte> The value to convert.

Returns — A new T instance converted from value.

implicit operator T(ReadOnlySpan<char>)

public static abstract implicit operator T(ReadOnlySpan<char> value);

Implicitly converts the specified ReadOnlySpan<char> into a new T instance using the default Encoding.

Parameter Type Description
value ReadOnlySpan<char> The value to convert.

Returns — A new T instance converted from value.

implicit operator T(ReadOnlyMemory<char>)

public static abstract implicit operator T(ReadOnlyMemory<char> value);

Implicitly converts the specified ReadOnlyMemory<char> into a new T instance using the default Encoding.

Parameter Type Description
value ReadOnlyMemory<char> The value to convert.

Returns — A new T instance converted from value.

implicit operator T(ReadOnlySequence<char>)

public static abstract implicit operator T(ReadOnlySequence<char> value);

Implicitly converts the specified ReadOnlySequence<char> into a new T instance using the default Encoding.

Parameter Type Description
value ReadOnlySequence<char> The value to convert.

Returns — A new T instance converted from value.

See Also

ONIXLabs .NET Library


Clone this wiki locally