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

System.Text.UTF8Encoding.GetCharCount Method

Returns the number of characters produced by decoding the specified range of the specified byte array as a System.Text.UTF8Encoding .

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

Parameters

bytes
The byte array to decode as a System.Text.UTF8Encoding .
index
A int that specifies the first index of bytes to decode.
count
A int that specifies the number of bytes to decode.

Returns

A int that indicates the number of characters produced by decoding the range in bytes from index to index + count - 1 as a System.Text.UTF8Encoding .

Exceptions

TypeReason
ArgumentNullExceptionbytes is null.
ArgumentOutOfRangeException

index or count is less than zero.

-or-

index and count do not specify a valid range in bytes (i.e. (index + count) > bytes.Length).

ArgumentExceptionError-checking is turned on for the current instance and bytes contains an invalid surrogate sequence.

Remarks

If error-checking is turned off and an invalid surrogate sequence is detected, the invalid bytes are ignored and do not affect the return value, and no exception is thrown.

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