Mono Class Library: System.Text.ASCIIEncoding Overview | Members

System.Text.ASCIIEncoding.GetMaxByteCount Method

Returns the maximum number of bytes required to encode the specified number of characters as ASCII-encoded characters, regardless of the actual character values.

public override int GetMaxByteCount (int charCount)

Parameters

charCount
A int that specifies the number of characters to encode as ASCII-encoded characters.

Returns

A int containing the maximum number of bytes required to encode charCount characters as ASCII-encoded characters.

Exceptions

TypeReason
ArgumentOutOfRangeExceptioncharCount < 0.

Remarks

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.

Requirements

Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0