コード例 #1
0
        T ITypeSerializer <T> .Deserialize(ref StreamingIterator iterator)
        {
            T result = new T();

            while (iterator.HasNext())
            {
                TKey   key   = iterator.NextAsWithoutTag <TKey>();
                TValue value = iterator.HasNext() ? iterator.NextAsWithoutTag <TValue>() : default;
                result.Add(key, value);
            }

            return(result);
        }
コード例 #2
0
        Dictionary <TKey, TValue> ITypeSerializer <Dictionary <TKey, TValue> > .Deserialize(ref StreamingIterator iterator)
        {
            int count = iterator.HasNext() ? iterator.NextAsInt32WithoutTag(NumberFormat.Variant) : 0;
            Dictionary <TKey, TValue> result = new Dictionary <TKey, TValue>(count);

            while (iterator.HasNext())
            {
                TKey   key   = iterator.NextAsWithoutTag <TKey>();
                TValue value = iterator.HasNext() ? iterator.NextAsWithoutTag <TValue>() : default;
                result.Add(key, value);
            }

            return(result);
        }
コード例 #3
0
        T ITypeSerializer <T> .Deserialize(ref StreamingIterator iterator)
        {
            T result = new T();

            while (iterator.HasNext())
            {
                result.Add(iterator.NextAsWithoutTag <TValue>());
            }

            return(result);
        }
コード例 #4
0
        List <T> ITypeSerializer <List <T> > .Deserialize(ref StreamingIterator iterator)
        {
            int      count  = iterator.HasNext() ? iterator.NextAsInt32WithoutTag(NumberFormat.Variant) : 0;
            List <T> result = new List <T>(count);

            while (iterator.HasNext())
            {
                result.Add(iterator.NextAsWithoutTag <T>());
            }

            return(result);
        }
コード例 #5
0
        T[] ITypeSerializer <T[]> .Deserialize(ref StreamingIterator iterator)
        {
            int len = iterator.HasNext() ? iterator.NextAsInt32WithoutTag(NumberFormat.Variant) : 0;

            T[] result = new T[len];

            for (int i = 0; i < len && iterator.HasNext(); i++)
            {
                result[i] = iterator.NextAsWithoutTag <T>();
            }

            return(result);
        }
コード例 #6
0
        T ITypeSerializer <T> .Deserialize(ref StreamingIterator iterator)
        {
            int count = iterator.HasNext() ? iterator.NextAsInt32WithoutTag(NumberFormat.Variant) : 0;

            T result = new T();

            result.Initialize(count);

            while (iterator.HasNext())
            {
                result.Add(iterator.NextAsWithoutTag <TValue>());
            }

            return(result);
        }