System.Text.UTF7Encoding.GetByteCount Method

Calculates the number of bytes produced by encoding a set of characters starting at the specified character pointer.

Syntax

[System.CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(false)]
public override int GetByteCount (char* chars, int count)

Parameters

chars
A pointer to the first character to encode.
count
The number of characters to encode.

Returns

The number of bytes produced by encoding the specified characters.

Remarks

To calculate the exact array size that UTF7Encoding.GetBytes(string, int, int, Byte[], int) requires to store the resulting bytes, the application uses UTF7Encoding.GetByteCount(Char[], int, int). To calculate the maximum array size, the application should use UTF7Encoding.GetMaxByteCount(int). The UTF7Encoding.GetByteCount(Char[], int, int) method generally allows allocation of less memory, while the UTF7Encoding.GetMaxByteCount(int) method generally executes faster.

Requirements

Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0