<PackageReference Include="System.Reflection.Metadata" Version="11.0.0-preview.3.26207.106" />

System.Reflection.Metadata.MetadataStringDecoder

public class MetadataStringDecoder
Provides the MetadataReader with a custom mechanism for decoding byte sequences in metadata that represent text.
public static MetadataStringDecoder DefaultUTF8 { get; }

Gets the default decoder used by MetadataReader to decode UTF-8 when no decoder is provided to the constructor.

public Encoding Encoding { get; }

Gets the encoding used by this instance.

Initializes a new instance of the MetadataStringDecoder class using the given encoding.

public virtual string GetString(Byte* bytes, int byteCount)

Obtains strings for byte sequences in metadata. Override this to cache strings if required. Otherwise, it is implemented by forwarding straight to Encoding and every call will allocate a new string.