Returns a Unicode byte order mark encoded in UTF-16 format
Imports System
Imports System.Text
Imports Microsoft.VisualBasic
Class UnicodeEncodingExample
Public Shared Sub Main()
Dim byteOrderMark() As Byte
Dim b As Byte
byteOrderMark = Encoding.Unicode.GetPreamble()
For Each b In byteOrderMark
Console.Write("[{0}]", b)
Next b
Dim bigEndianUnicode As New UnicodeEncoding(True, True)
byteOrderMark = bigEndianUnicode.GetPreamble()
For Each b In byteOrderMark
Console.Write("[{0}]", b)
Next b
End Sub
End Class
Related examples in the same category