コード例 #1
0
        public List <I> Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(new List <I>());
            }
            List <I> list = new AlwaysSendList <I>();

            while (!context.Peek(JsonToken.ArrayEnd))
            {
                list.Add(iUnmarshaller.Unmarshall(context));
            }
            context.Read();
            return(list);
        }
コード例 #2
0
        public List <I> Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read(); // Read [ or null
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(new List <I>());
            }

            // If a list is present in the response, use AlwaysSendList,
            // so if the response was empty, reusing the object in the request we will
            // end up sending the same empty collection back.
            List <I> list = new AlwaysSendList <I>();

            while (!context.Peek(JsonToken.ArrayEnd)) // Peek for ]
            {
                list.Add(iUnmarshaller.Unmarshall(context));
            }
            context.Read(); // Read ]
            return(list);
        }