Calculates the maximum number of bytes produced by encoding the specified number of characters.
Imports System
Imports System.Text
Class UnicodeEncodingExample
Public Shared Sub Main()
Dim uni As New UnicodeEncoding()
Dim charCount As Integer = 2
Dim maxByteCount As Integer = uni.GetMaxByteCount(charCount)
Console.WriteLine("Maximum of {0} bytes needed to encode {1} characters.", maxByteCount, charCount)
End Sub
End Class