Calculates the number of bytes produced by encoding the characters in the specified String.
Imports System Imports System.Text Class UTF8EncodingExample Public Shared Sub Main() Dim chars As String = "UTF8 Encoding Example" Dim utf8 As New UTF8Encoding() Dim byteCount As Integer = utf8.GetByteCount(chars) Console.WriteLine("{0} bytes needed to encode string.", byteCount) End Sub End Class