public static void WriteValueU16(this Stream stream, UInt16 value, bool littleEndian) { if (ShouldSwap(littleEndian)) { value = value.Swap(); } byte[] data = BitConverter.GetBytes(value); Debug.Assert(data.Length == 2); stream.Write(data, 0, 2); }
public static void WriteValueU16(this Stream stream, UInt16 value, Endian endian) { if (ShouldSwap(endian) == true) { value = value.Swap(); } var data = BitConverter.GetBytes(value); Debug.Assert(data.Length == 2); stream.WriteBytes(data); }
public static void WriteU16BE(this Stream stream, UInt16 value) { byte[] data = BitConverter.GetBytes(value.Swap()); stream.Write(data, 0, 2); }