Imports System
Imports System.Text
Namespace GetPreambleExample
Class GetPreambleExampleClass
Shared Sub Main()
Dim [unicode] As Encoding = Encoding.Unicode
Dim preamble As Byte() = [unicode].GetPreamble()
If preamble.Length >= 2 Then
If preamble(0) = &HFE And preamble(1) = &HFF Then
Console.WriteLine("The Unicode encoder is encoding in big-endian order.")
Else
If preamble(0) = &HFF And preamble(1) = &HFE Then
Console.WriteLine("The Unicode encoder is encoding in little-endian order.")
End If
End If
End If
End Sub
End Class
End Namespace