我需要能够将两个 ASCII 字节打包成一个 ushort。我怎样才能做到这一点?
到目前为止,我有:
for (var i = 0; i < asciiBytes.Length; i += 2)
{
// Get two bytes from an ASCII byte array.
var sub = new[] { asciiBytes[i], asciiBytes[i + 1] };
// Pack the two bytes into a ushort
// ????????
}