Table of Contents

Method FromUnmanaged

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

FromUnmanaged(byte*, nuint)

Creates a nullable LazyEncodedString from an unmanaged view

public static LazyEncodedString? FromUnmanaged(byte* p, nuint len)

Parameters

p byte*

pointer to first character of view

len nuint

length of the view

Returns

LazyEncodedString

LazyEncodedString

Remarks

To preserve the potential meaning distinction between null and empty strings, this will treat a null for p as a null return value. Empty, strings are a Empty.

note

This method handles safely converting (down casting) the length to an int as required by .NET runtime types. [nuint is used as managed equivalent of size_t, though the formal C/C++ definition is compiler/platform specific. Most use an unsigned 64 bit value for a 64 bit platform and an unsigned 32 bit value for 32 bit platforms.]

FromUnmanaged(byte*)

Creates a nullable LazyEncodedString from an unmanaged string pointer (terminated!)

public static LazyEncodedString? FromUnmanaged(byte* p)

Parameters

p byte*

pointer to first character of string

Returns

LazyEncodedString

LazyEncodedString

Remarks

To preserve the potential meaning distinction between null and empty strings, this will treat a null for p as a null return value. Empty, strings are always Empty.