ByteOrder.Type เป็นชุดค่าคงที่สำหรับกำหนดลำดับไบต์ของข้อมูลไบนารี โดย ByteOrder.LittleEndian หมายถึงไบต์น้อย (least significant byte) มาก่อน และ ByteOrder.BigEndian หมายถึงไบต์มาก (most significant byte) มาก่อน ค่านี้ใช้เป็นพารามิเตอร์ byteOrder ของ BinaryFormat.ByteOrder เพื่อให้การอ่านค่าเลขจากไบนารีถูกต้อง
=BinaryFormat.ByteOrder(binaryFormat, ByteOrder.LittleEndian|BigEndian)
=BinaryFormat.ByteOrder(binaryFormat, ByteOrder.LittleEndian|BigEndian)
เมื่อรับไฟล์/สตรีมไบนารีจากระบบอื่น ให้กำหนด ByteOrder ให้ตรงกับรูปแบบของไฟล์ เพื่อหลีกเลี่ยงการอ่านค่าเพี้ยน
let Bytes = Binary.FromList({1, 0}), Fmt = BinaryFormat.ByteOrder(BinaryFormat.UnsignedInteger16, ByteOrder.LittleEndian), Value = Fmt(Bytes) in Valuelet Bytes = Binary.FromList({1, 0}), Fmt = BinaryFormat.ByteOrder(BinaryFormat.UnsignedInteger16, ByteOrder.LittleEndian), Value = Fmt(Bytes) in Value
1
let Bytes = Binary.FromList({1, 0}), Fmt = BinaryFormat.ByteOrder(BinaryFormat.UnsignedInteger16, ByteOrder.BigEndian), Value = Fmt(Bytes) in Valuelet Bytes = Binary.FromList({1, 0}), Fmt = BinaryFormat.ByteOrder(BinaryFormat.UnsignedInteger16, ByteOrder.BigEndian), Value = Fmt(Bytes) in Value
256
let Bytes = Binary.FromList({1, 0}), Value = BinaryFormat.UnsignedInteger16(Bytes) in Valuelet Bytes = Binary.FromList({1, 0}), Value = BinaryFormat.UnsignedInteger16(Bytes) in Value
256
ให้ดูสเปกของไฟล์/โปรโตคอลต้นทาง ถ้าระบุว่า Little Endian ให้ใช้ ByteOrder.LittleEndian ถ้าเป็น Big Endian ให้ใช้ ByteOrder.BigEndian เพื่ออ่านค่าเลขถูกต้อง
ByteOrder.Type คือชุดค่าคงที่ที่ใช้กำหนดลำดับไบต์ (Endian) เวลาตีความข้อมูลไบนารี เช่น Little Endian หรือ Big Endian โดยมักใช้เป็นพารามิเตอร์ให้กับ BinaryFormat.ByteOrder