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

System.Text.ASCIIEncoding.GetMaxCharCount Method

Gets the maximum number of characters produced by decoding a specified number of bytes as ASCII-encoded characters, regardless of the actual byte values.

public override int GetMaxCharCount (int byteCount)

Parameters

byteCount
A int that specifies the number of bytes to decode as ASCII-encoded characters.

Returns

A int containing the maximum number of characters that would be produced by decoding byteCount bytes as ASCII-encoded characters.

Exceptions

TypeReason
ArgumentOutOfRangeExceptionbyteCount < 0.

Remarks

Note:

This method overrides Encoding.GetMaxCharCount(int) .

Use this method to determine the minimum buffer size for character arrays passed to the ASCIIEncoding.GetChars(Byte[], int, int, Char[], int) or the Encoding.GetChars(Byte[]) methods. 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