Пример #1
0
 /// <summary>
 /// 字节数组中截取转成16位无符号整型
 /// </summary>
 /// <param name="source"></param>
 /// <param name="start"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static ushort GetUShortFromByteArray(byte[] source, int start = 0, DataFormat type = DataFormat.ABCD)
 {
     return(BitConverter.ToUInt16(ByteArrayLib.Get2ByteArray(source, start, type), 0));
 }
Пример #2
0
 /// <summary>
 /// 字节数组中截取转成16位整型
 /// </summary>
 /// <param name="source"></param>
 /// <param name="start"></param>
 /// <param name="dataFormat"></param>
 /// <returns></returns>
 public static short GetShortFromByteArray(byte[] source, int start = 0, DataFormat dataFormat = DataFormat.ABCD)
 {
     return(BitConverter.ToInt16(ByteArrayLib.Get2ByteArray(source, start, dataFormat), 0));
 }