Encodes the specified range of the specified char array into the specified range of the specified byte array.
The number of bytes encoded into bytes .
Type Reason ArgumentException bytes does not contain sufficient space to store the encoded characters. ArgumentNullException chars is null.
-or-
bytes is null.
ArgumentOutOfRangeException charIndex < 0.
-or-
charCount < 0.
-or-
byteIndex < 0.
-or-
(chars.Length - charIndex) < charCount.
-or-
byteIndex > bytes.Length.
Operation
As described above.Note to Inheritors
This method is overridden by types derived from System.Text.Encoding to perform the encoding.Usage
Encoding.GetByteCount(Char[]) can be used to determine the exact number of bytes that will be produced for a given range of characters. Alternatively, Encoding.GetMaxByteCount(int) can be used to determine the maximum number of bytes that will be produced for a given number of characters, regardless of the actual character values.
Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0