TextEncoder.EncodeUtf8 Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Encodes the supplied UTF-8 text.

C#
public virtual System.Buffers.OperationStatus EncodeUtf8(ReadOnlySpan<byte> utf8Source, Span<byte> utf8Destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock = true);

Parameters

utf8Source
ReadOnlySpan<Byte>

A source buffer containing the UTF-8 text to encode.

utf8Destination
Span<Byte>

The destination buffer to which the encoded form of utf8Source will be written.

bytesConsumed
Int32

The number of bytes consumed from the utf8Source buffer.

bytesWritten
Int32

The number of bytes written to the utf8Destination buffer.

isFinalBlock
Boolean

true to indicate there is no further source data that needs to be encoded; otherwise, false.

Returns

A status code that describes the result of the encoding operation.

Remarks

The utf8Source and utf8Destination buffers must not overlap.

Applies to

Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)