Returns the maximum number of bytes required to encode the specified number of characters as Unicode-encoded characters, regardless of the actual character values.
- charCount
- A int whose value represents a number of characters to encode as Unicode-encoded characters.
A int containing the maximum number of bytes required to encode charCount characters as Unicode-encoded characters.
Type Reason ArgumentOutOfRangeException charCount < 0.
Note:This method overrides Encoding.GetMaxByteCount(int).
Use this method to determine an appropriate minimum buffer size for byte arrays passed to UnicodeEncoding.GetBytes(Char[], int, int, Byte[], int) or Encoder.GetBytes(Char[], int, int, Byte[], int, bool) for the current instance. Using this minimum buffer size can help ensure that buffer overflow exceptions do not occur.
Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0