Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }