/// <summary>
        /// Binary deserialize
        /// </summary>
        /// <param name="reader">Reader of binary</param>
        public List <T> BinaryDeserialize(ref BinarySpanReader reader)
        {
            var length = BitConverter.ToInt32(reader.Read(sizeof(int)));

            if (length == 0)
            {
                return(null);
            }
            var instance = new List <T>();

            for (int i = 0; i < length; i++)
            {
                instance.Add(typeGoInfo.BinaryDeserialize(ref reader));
            }
            return(instance);
        }
Esempio n. 2
0
        /// <summary>
        /// Binary deserialize
        /// </summary>
        /// <param name="reader">Reader of binary</param>
        public T[] BinaryDeserialize(ref BinarySpanReader reader)
        {
            int length = BitConverter.ToInt32(reader.Read(sizeof(int)));

            if (length == -1)
            {
                return(null);
            }
            else if (length == 0)
            {
                return(new T[0]);
            }
            T[] instance = new T[length];
            for (int i = 0; i < length; i++)
            {
                instance[i] = typeGoInfo.BinaryDeserialize(ref reader);
            }
            return(instance);
        }