Convert.ToUInt16 (Byte) converts 8-bit unsigned integer to 16-bit unsigned integer.
Class Sample
Public Shared Sub Main()
Dim bytes() As Byte = { Byte.MinValue, 14, 122, Byte.MaxValue}
Dim result As UShort
For Each number As Byte In bytes
result = Convert.ToUInt16(number)
Console.WriteLine("Converted the {0} value '{1}' to the {2} value {3}.", _
number.GetType().Name, number, _
result.GetType().Name, result)
Next
End Sub
End Class
Related examples in the same category