Example #1
0
        public int Transfer(T source, Addressable destination, long index)
        {
            string value  = property.GetValue(source);
            int    length = value != null?Encoding.UTF8.GetByteCount(value) : -1;

            destination.WriteInt32(index + 0, length);
            destination.WriteString(index + 4, value);

            return(NormalizeLength(length));
        }
Example #2
0
        public int Transfer(T source, Addressable destination, long index)
        {
            long initial = index;

            V[] value  = property.GetValue(source);
            int length = value?.Length ?? -1;

            destination.WriteInt32(initial + 4, length);
            index = index + 8;

            if (value != null)
            {
                foreach (V item in value)
                {
                    index = index + nested.Transfer(item, destination.Scope(index));
                }
            }

            destination.WriteInt32(initial, (int)(index - initial));
            return((int)(index - initial));
        }