Encoding::GetBytes Method (array<Char>, Int32, Int32)
When overridden in a derived class, encodes a set of characters from the specified character array into a sequence of bytes.
Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Parameters
- chars
- Type: array<System::Char>
The character array containing the set of characters to encode.
- index
- Type: System::Int32
The zero-based index of the first character to encode.
- count
- Type: System::Int32
The number of characters to encode.
Return Value
Type: array<System::Byte>A byte array containing the results of encoding the specified set of characters.
| Exception | Condition |
|---|---|
| ArgumentNullException | chars is nullptr. |
| ArgumentOutOfRangeException | index or count is less than zero. -or- index and count do not denote a valid range in chars. |
| EncoderFallbackException | 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.
For a discussion of programming considerations for use of this method, see the Encoding class description.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.