Struct B64
Represents an unsigned fixed-length radix-64 encoded integer.
public readonly record struct B64 : IEquatable<B64>
- Implements
- Inherited Members
Fields
MaxValue
The maximum value of a B64.
public const ushort MaxValue = 4095
Field Value
MinValue
The minimum value of a B64.
public const ushort MinValue = 0
Field Value
Methods
Decode(ReadOnlySpan<byte>)
Decodes a B64 value from the specified read-only byte span.
public static B64 Decode(ReadOnlySpan<byte> buf)
Parameters
buf
ReadOnlySpan<byte>The span to decode from.
Returns
- B64
The decoded B64 value.
Exceptions
- ArgumentOutOfRangeException
If the length of the provided span is less than 2.
- ArgumentException
If any of the input bytes' 2 most significant bits are not set to
01
.
Encode(Span<byte>, B64)
Encodes a B64 value to the specified span.
public static void Encode(Span<byte> buf, B64 value)
Parameters
Exceptions
- ArgumentOutOfRangeException
If the value is outside the range of a B64, or the length of the provided span is less than 2.
ToString()
Returns the value of this B64 as a string.
public override string ToString()
Returns
Operators
explicit operator B64(int)
public static explicit operator B64(int value)
Parameters
value
int
Returns
implicit operator B64(ushort)
public static implicit operator B64(ushort value)
Parameters
value
ushort
Returns
implicit operator ushort(B64)
public static implicit operator ushort(B64 b64)
Parameters
b64
B64