Determines the number of bytes required to encode the characters in the specified string as a System.Text.UTF8Encoding.
- chars
- A string to encode as a System.Text.UTF8Encoding.
A int that specifies the number of bytes necessary to encode chars as a System.Text.UTF8Encoding.
Type Reason ArgumentNullException chars is null. ArgumentException Error-checking is turned on for the current instance and chars contains an invalid surrogate sequence. ArgumentOutOfRangeException The return value is greater than int.MaxValue.
If error-checking is turned off and an invalid surrogate sequence is detected, the invalid characters are ignored and do not affect the return value, and no exception is thrown.
Note: This method overrides Encoding.GetByteCount(Char[]).
Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0