Calculates the number of bytes produced by encoding the characters in the specified string object.
- s
- The string object containing the set of characters to encode.
The number of bytes produced by encoding the specified characters.
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.