BitConverter.ToUInt16 returns a 16-bit unsigned integer converted from two bytes
Imports System
Imports Microsoft.VisualBasic
Module BytesToUInt16Demo
Sub BAToUInt16( bytes( ) As Byte, index As Integer )
Dim value As UInt16 = BitConverter.ToUInt16( bytes, index )
Console.WriteLine( value )
End Sub
Sub Main( )
Dim byteArray as Byte( ) = {15, 0, 0, 255, 3, 16, 39, 255, 255, 127 }
Console.WriteLine( BitConverter.ToString( byteArray ) )
BAToUInt16( byteArray, 1 )
End Sub
End Module
Related examples in the same category