toBytes

Converts an array of type T into an ubyte array.

Omron stores data in LittleEndian format.

ubyte[]
toBytes
(
T
)
(
T[] input
)

Return Value

Type: ubyte[]

An array of ubyte

Examples

1 [0x8034].toBytes!ushort().shouldEqual([0x34, 0x80]);
2 
3 ushort[] buf = [0x8034, 0x2010];
4 buf.toBytes!ushort().shouldEqual([0x34, 0x80, 0x10, 0x20]);
5 buf.length.shouldEqual(2);
6 
7 [0x8034].toBytes!uint().shouldEqual([0x34, 0x80, 0, 0]);
8 [0x010464].toBytes!uint().shouldEqual([0x64, 0x04, 1, 0]);

Meta