Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Method

Decode

abstract virtual func Decode(bytes: ReadOnlySlice<byte>) -> Result<string, EncodingError>

Declaring type: Encoding
Module: System.Text
Assembly: System.Runtime.dll
Source file: Encoding.rvn

Defined by Encoding.Decode · Required implementation (no default).

Interface implementation: Required implementation (no default).

Decodes one complete borrowed byte window with strict error reporting and no retained session state. Built-in providers accept at most 65536 bytes, preserve BOM data and reject truncated input.

Parameters

Name Type Description
bytes ReadOnlySlice<Byte> The complete encoded input, borrowed only for this call.

Return value

Result<String, EncodingError>

Decoded text, InvalidUtf8, InvalidData, or LimitExceeded for the built-in providers.