Export (0) Print
Expand All

UTF8Encoding.GetString Method

Decodes a range of bytes from a byte array into a string.

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

[SecuritySafeCriticalAttribute]
[ComVisibleAttribute(false)]
public override string GetString(
	byte[] bytes,
	int index,
	int count
)

Parameters

bytes
Type: 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 that contains the results of decoding the specified sequence of bytes.

ExceptionCondition
ArgumentNullException

bytes is null.

ArgumentOutOfRangeException

index or count is less than zero.

-or-

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

ArgumentException

Error detection is enabled, and bytes contains an invalid sequence of bytes.

DecoderFallbackException

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

With error detection, an invalid sequence causes this method to throw a ArgumentException. Without error detection, invalid sequences are ignored, and no exception is thrown.

Data to be converted, such as data read from a stream, might be available only in sequential blocks. In this case, or if the amount of data is so large that it needs to be divided into smaller blocks, the application uses the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively.

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:
© 2014 Microsoft