Amazon.Runtime.Internal.Transform.JsonUnmarshallerContext.Peek C# (CSharp) Method

Peek() public method

Peeks at the next token. This peek implementation reads the next token and makes the subsequent Read() return the same data. If Peek is called successively, it will return the same data. Only the first one calls Read(), subsequent calls will return the same data until a Read() call is made.
public Peek ( JsonToken token ) : bool
token JsonToken Token to peek.
return bool
        public bool Peek(JsonToken token)
        {
            if (wasPeeked)
                return currentToken != null && currentToken == token;

            if (Read())
            {
                wasPeeked = true;
                return currentToken == token;
            }
            return false;
        }

Same methods

JsonUnmarshallerContext::Peek ( ) : int

Usage Example

Example #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);
        }
All Usage Examples Of Amazon.Runtime.Internal.Transform.JsonUnmarshallerContext::Peek