Constructor LazyEncodedString
- Namespace
- Ubiquity.NET.InteropHelpers
- Assembly
- Ubiquity.NET.InteropHelpers.dll
LazyEncodedString(string, Encoding?)
Initializes a new instance of the LazyEncodedString class from an existing managed string
public LazyEncodedString(string managed, Encoding? encoding = null)
Parameters
managedstringstring to lazy encode for native code use
encodingEncodingEncoding to use for the string [Optional: Defaults to UTF8 if not provided]
LazyEncodedString(ReadOnlySpan<byte>, Encoding?)
Initializes a new instance of the LazyEncodedString class from an existing span of native bytes
public LazyEncodedString(ReadOnlySpan<byte> span, Encoding? encoding = null)
Parameters
spanReadOnlySpan<byte>span of native bytes
encodingEncodingEncoding to use for the string [Optional: Defaults to UTF8 if not provided]
Remarks
This has some performance overhead as it MUST make a copy of the contents of the span. The lifetime
of span is not guaranteed beyond this call and is not allowed as a field of this type.