Beispiel #1
0
        public static TestPacket2 D(ReadOnlyMemory <byte> buffer)
        {
            var res  = new TestPacket2();
            var temp = new byte[4];

            buffer.Span.Slice(0, 4).CopyTo(temp);
            res.Value = BitConverter.ToSingle(temp, 0);
            return(res);
        }
Beispiel #2
0
 public static ushort S(TestPacket2 message, Span <byte> buffer)
 {
     BitConverter.GetBytes(message.Value).AsSpan().CopyTo(buffer);
     return(1000);
 }