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

System.Text.UnicodeEncoding.GetMaxCharCount Method

Returns the maximum number of characters produced by decoding the specified number of bytes as Unicode-encoded characters, regardless of the actual byte values. [Edit]

public override int GetMaxCharCount (int byteCount)

Parameters

byteCount
A int specifies the number of bytes to decode as Unicode-encoded characters. [Edit]

Returns

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

Exceptions

TypeReason
ArgumentOutOfRangeExceptionbyteCount < 0. [Edit]

Remarks

Note:

This method overrides Encoding.GetMaxCharCount(int).

Use this method to determine an appropriate minimum buffer size for byte arrays passed to UnicodeEncoding.GetChars(Byte[], int, int, Char[], int) or Encoding.GetChars(Byte[]) for the current instance. Using this minimum buffer size can help ensure that no buffer overflow exceptions will occur.

[Edit]

Requirements

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