Repository navigation
OnixLabs.Core.Text.ReadOnlySpanExtensions
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
|
[EditorBrowsable(EditorBrowsableState.Never)]
public static class ReadOnlySpanExtensionsNote 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.
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;| 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. |
public Base16 ToBase16()Converts the current ReadOnlySpan<byte> into a new Base16 instance.
Returns — A new Base16 instance wrapping the bytes in the span.
public Base32 ToBase32()Converts the current ReadOnlySpan<byte> into a new Base32 instance.
Returns — A new Base32 instance wrapping the bytes in the span.
public Base58 ToBase58()Converts the current ReadOnlySpan<byte> into a new Base58 instance.
Returns — A new Base58 instance wrapping the bytes in the span.
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();ONIXLabs .NET Library · Repository · NuGet · License (Apache-2.0)
Copyright © ONIXLabs 2020. Licensed under the Apache License, Version 2.0.
- Enumeration<T>
- Optional<T>
- OptionalEqualityComparer<T>
- OptionalExtensions
- Result
- Result<T>
- ResultEqualityComparer<T>
- ResultExtensions
- Specification<T>
- Preconditions
- IValueEquatable<T>
- IValueComparable<T>
- IBinaryConvertible
- ISpanBinaryConvertible
- IMemoryBinaryConvertible
- ArrayExtensions
- ComparableExtensions
- DateTimeExtensions
- ISpanParsableExtensions
- ObjectExtensions
- RandomExtensions
- ReadOnlySequenceExtensions
- ReadOnlySpanExtensions
- StringExtensions
- Base16
- Base32
- Base58
- Base64
- IBaseCodec
- IBaseValue
- IBaseValue<T>
- Base16Codec
- Base32Codec
- Base58Codec
- Base64Codec
- Base16FormatProvider
- Base32FormatProvider
- Base58FormatProvider
- Base64FormatProvider
- EncodingExtensions
- ReadOnlySpanExtensions
- StringBuilderExtensions
- BigDecimal
- BigDecimalEqualityComparer
- BigDecimalOrdinalityComparer
- NumberInfo
- NumberInfoEqualityComparer
- NumberInfoOrdinalityComparer
- Int256
- Int512
- UInt256
- UInt512
- Float128
- Float256
- GenericMath
- NumericsExtensions
- ConversionMode
- ScaleMode
- Hash
- NamedHash
- Sha3
- Sha3Hash224
- Sha3Hash256
- Sha3Hash384
- Sha3Hash512
- Sha3Shake128
- Sha3Shake256
- MerkleTree
- MerkleTree<T>
- PrivateKey
- PublicKey
- NamedPrivateKey
- NamedPublicKey
- EcdhPrivateKey
- EcdhPublicKey
- EcdsaPrivateKey
- EcdsaPublicKey
- EddsaPrivateKey
- EddsaPublicKey
- RsaPrivateKey
- RsaPublicKey
- DigitalSignature
- DigitalSignatureAndPublicKey
- Salt
- Secret
- ICryptoPrimitive<T>
- IHashable
- IEcdhPrivateKey
- IEcdsaPrivateKey
- IEddsaPrivateKey
- IRsaPrivateKey
- IPrivateKeyDerivable<T>
- IPrivateKeyExportable
- IPrivateKeyImportable<T>
- IPrivateKeyPemImportable<T>
- IPrivateKeyPkcs8Exportable
- IPrivateKeyPkcs8Importable<T>
- IPrivateKeyPkcs8PemExportable
- IPrivateKeyRawExportable
- IPrivateKeyRawImportable<T>
- IPrivateKeyRawPemExportable
- IEcdhPublicKey
- IEcdsaPublicKey
- IEddsaPublicKey
- IRsaPublicKey
- IPublicKeyExportable
- IPublicKeyImportable<T>
- IPublicKeyPemExportable
- IPublicKeyPemImportable<T>
- IPublicKeyRawExportable
- IPublicKeyRawImportable<T>
- HashAlgorithmExtensions
- ReadOnlySpanExtensions