Calculates number of bytes produced by encoding a set of characters from the specified character array.
Imports System
Imports System.Text
Imports Microsoft.VisualBasic.Strings
Class UTF8EncodingExample
Public Shared Sub Main()
Dim chars() As Char = {ChrW(35), ChrW(37), ChrW(928), ChrW(931)}
Dim utf8 As New UTF8Encoding()
Dim byteCount As Integer = utf8.GetByteCount(chars, 1, 2)
Console.WriteLine("{0} bytes needed to encode characters.", byteCount)
End Sub
End Class
Related examples in the same category