Mega Code Archive

 
Categories / VB.Net / Development
 

BitConverter ToInt16 returns a 16-bit signed integer converted from two bytes

Imports System Imports Microsoft.VisualBasic Module BytesToInt16Demo     Sub BAToInt16( bytes( ) As Byte, index As Integer )         Dim value As Short = BitConverter.ToInt16( bytes, index )         Console.WriteLine( value )     End Sub      Sub Main( )         Dim byteArray as Byte( ) = {15, 0, 0, 128, 16, 39, 240, 216, 241, 255, 127 }         BAToInt16( byteArray, 1 )     End Sub  End Module