void IInteroperable.FromStackItem(StackItem stackItem) { Struct @struct = (Struct)stackItem; BlockIndex = (uint)@struct[0].GetInteger(); _rawTransaction = ((ByteString)@struct[1]).Memory; Transaction = _rawTransaction.AsSerializable <Transaction>(); State = (VMState)(byte)@struct[2].GetInteger(); }
public static ConsensusMessage DeserializeFrom(ReadOnlyMemory <byte> data) { ConsensusMessageType type = (ConsensusMessageType)data.Span[0]; Type t = typeof(ConsensusMessage); t = t.Assembly.GetType($"{t.Namespace}.{type}", false); if (t is null) { throw new FormatException(); } return((ConsensusMessage)data.AsSerializable(t)); }