public Construct Attach(Type type, object value) { var c = _pool.Get(type); var bytes = c.ToBytes(value, _pool); if (bytes != null) { _bytes.AddRange(bytes); } return(this); }
public object Detach(Type type, out int length) { var span = _bytes.AsSpan(_index); var marshaller = _pool.Get(type); var result = marshaller.FromBytes(span.ToArray(), out var spanLength, _pool); _index += spanLength; length = _index; return(result); }