UTF8Encoding.GetString Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Decodes a range of bytes from a byte array into a string.
Assembly: mscorlib (in mscorlib.dll)
'Declaration Public Overrides Function GetString ( _ bytes As Byte(), _ index As Integer, _ count As Integer _ ) As String
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.StringA string that contains the results of decoding the specified sequence of bytes.
| Exception | Condition |
|---|---|
| ArgumentNullException | bytes is Nothing. |
| 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. |
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.