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
managed
stringstring to lazy encode for native code use
encoding
EncodingEncoding 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
span
ReadOnlySpan<byte>span of native bytes
encoding
EncodingEncoding 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.