Encoding::GetString Method

When overridden in a derived class, decodes a sequence of bytes from the specified byte array into a string.

Namespace:  System.Text
Assembly:  mscorlib (in mscorlib.dll)

No code example is currently available or this language may not be supported.

Parameters

bytes
Type: array<System::Byte>
The byte array containing the sequence of bytes to decode.
index
Type: System::Int32
The zero-based index of the first byte to decode.
count
Type: System::Int32
The number of bytes to decode.

Return Value

Type: System::String
A String containing the results of decoding the specified sequence of bytes.

ExceptionCondition
ArgumentNullException

bytes is nullptr.

ArgumentOutOfRangeException

index or count is less than zero.

-or-

index and count do not denote a valid range in bytes.

DecoderFallbackException

A fallback occurred (see Understanding Encodings for complete explanation).

If the data to be converted is available only in sequential blocks (such as data read from a stream) or if the amount of data is so large that it needs to be divided into smaller blocks, the application should use the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively, of a derived class.

The following example uses the GetString method to decode an array of UTF16-encoded bytes.

No code example is currently available or this language may not be supported.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show: