Table of Contents

Class EncodingExtensions

Namespace
Ubiquity.NET.InteropHelpers
Assembly
Ubiquity.NET.InteropHelpers.dll

Utility extensions for the Encoding class

public static class EncodingExtensions
Inheritance
EncodingExtensions
Inherited Members

Remarks

These differ from the APIs already present on Encoding with respect to handling of null and empty spans. Specifically, these implementation don't throw an exception in such a case. They just return null when given that as the input. That is, if given null these will return null so that the resulting value mirrors the native value. This is especially important in scenarios where a null value has a distinct meaning from an empty string.

Methods

MarshalString(Encoding, byte*)

Provides conversion of the native bytes to managed code

MarshalString(Encoding, ReadOnlySpan<byte>)

Provides conversion of a span of bytes to managed code