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

System.Text.ASCIIEncoding.GetCharCount Method

Determines the exact number of characters that will be produced by decoding the specified range of the specified array of bytes as ASCII-encoded characters.

public override int GetCharCount (byte[] bytes, int index, int count)

Parameters

bytes
A byte array to decode as ASCII-encoded characters.
index
A int that specifies the first index in bytes to decode.
count
A int that specifies the number elements in bytes to decode.

Returns

A int whose value equals the number of characters a call to ASCIIEncoding.GetChars(Byte[], int, int, Char[], int) will produce if presented with the specified range of bytes.

Note: This value does not take into account the state in which the current instance was left following the last call to ASCIIEncoding.GetChars(Byte[], int, int, Char[], int). This contrasts with Decoder.GetChars(Byte[], int, int, Char[], int) , which maintains state information across calls.

Exceptions

TypeReason
ArgumentNullExceptionbytes is null.
ArgumentOutOfRangeException

index < 0.

-or-

count < 0.

-or-

(bytes.Length - index) < count.

Remarks

Note: This method overrides Encoding.GetCharCount(Byte[]).

Requirements

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