Returns the maximum number of bytes required to encode the specified number of characters as ASCII-encoded characters, regardless of the actual character values.
- charCount
- A int that specifies the number of characters to encode as ASCII-encoded characters.
A int containing the maximum number of bytes required to encode charCount characters as ASCII-encoded characters.
Type Reason ArgumentOutOfRangeException charCount < 0.
Note:This method overrides Encoding.GetMaxByteCount(int) .
Use this method to determine a minimum buffer size for byte arrays passed to the ASCIIEncoding.GetBytes(Char[], int, int, Byte[], int) or Encoding.GetBytes(Char[]) method 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