Mega Code Archive

 
Categories / VB.Net / Development
 

Convert ToUInt16 (Char) converts Unicode character to 16-bit unsigned integer

Class Sample    Public Shared Sub Main()         Dim chars() As Char = { "a"c, "z"c, ChrW(7), ChrW(Short.MaxValue), ChrW(&hFFFE) }         Dim result As UShort                  For Each ch As Char in chars            result = Convert.ToUInt16(ch)            Console.WriteLine("Converted the {0} value '{1}' to the {2} value {3}.", _                              ch.GetType().Name, ch, _                              result.GetType().Name, result)         Next        End Sub  End Class