C# UTF8Encoding GetByteCount(Char[])
Description
UTF8Encoding GetByteCount(Char[])
When overridden
in a derived class, calculates the number of bytes produced by encoding all
the characters in the specified character array.
Syntax
UTF8Encoding.GetByteCount(Char[])
has the following syntax.
public virtual int GetByteCount(
char[] chars
)
Parameters
UTF8Encoding.GetByteCount(Char[])
has the following parameters.
chars
- The character array containing the characters to encode.
Returns
UTF8Encoding.GetByteCount(Char[])
method returns The number of bytes produced by encoding all the characters in the specified
character array.
Example
using System;//w w w . j ava 2 s . c o m
using System.Text;
public class SamplesEncoding {
public static void Main() {
char[] myChars = new char[] { 'z', 'a', '\u0306', '\u01FD'};
Encoding u8 = Encoding.UTF8;
int iBC = u8.GetByteCount( myChars );
}
}