Calculates the 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 UnicodeEncodingExample
Public Shared Sub Main()
Dim chars() As Char = {ChrW(931)}
Dim uni As New UnicodeEncoding()
Dim byteCount As Integer = uni.GetByteCount(chars, 1, 2)
Console.WriteLine("{0} bytes needed to encode characters.", byteCount)
End Sub
End Class
Related examples in the same category