Skip to content

OnixLabs.Core.Text.Base64FormatProvider

matthew edited this page May 27, 2026 · 1 revision

Base64FormatProvider Class

Represents a Base-64 format provider.

Namespace OnixLabs.Core.Text
Assembly OnixLabs.Core.dll (NuGet)
Inheritance object → Enumeration<Base64FormatProvider> → Base64FormatProvider
Implements IEquatable<Base64FormatProvider>, IComparable<Base64FormatProvider>, IComparable, IFormatProvider

Definition

public sealed class Base64FormatProvider : Enumeration<Base64FormatProvider>, IFormatProvider

Remarks

Base64FormatProvider is a smart enumeration that carries the alphabet used by Base64Codec to validate encoding and decoding operations. It derives from Enumeration<Base64FormatProvider> and implements IFormatProvider.

A single entry, Rfc4648, is declared. Unlike the other format providers, Base64FormatProvider does not vary the alphabet used by the underlying codec — Base64Codec always delegates to Convert.ToBase64String and Convert.FromBase64String. The provider is used to validate that the codec was invoked with a compatible format provider: supplying a provider of a different type causes the Try* operations to return false and the Encode/Decode operations to throw FormatException.

Because the type derives from Enumeration<T>, all entries are also available through the inherited static query methods such as GetAll, FromName, and FromValue.

Fields

The field is declared as public static readonly Base64FormatProvider.

Field Description
Rfc4648 The RFC 4648 Base-64 format provider. Alphabet ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=.

Rfc4648

public static readonly Base64FormatProvider Rfc4648;

The RFC 4648 Base-64 format provider. Alphabet ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=. This is the only declared entry and the default provider used by Base64Codec.

Properties

Property Type Description
Alphabet string Gets the Base-64 alphabet associated with the current format provider.

Alphabet

public string Alphabet { get; }

Gets the alphabet of the current Base64FormatProvider instance.

Methods

Method Returns Description
GetFormat(Type?) object? Returns the current instance when formatType is typeof(Base64FormatProvider); otherwise, returns null.

GetFormat(Type?)

public object? GetFormat(Type? formatType)

Returns the current instance when formatType is typeof(Base64FormatProvider); otherwise, returns null. This is the IFormatProvider contract method that allows the format provider to be passed to any API that accepts IFormatProvider.

Parameter Type Description
formatType Type? The type of format object to obtain.

Returns — The current instance if formatType is typeof(Base64FormatProvider); otherwise, null.

See Also

ONIXLabs .NET Library


Clone this wiki locally