Exemplo n.º 1
0
        /// <summary>
        /// Creates a new JSON reader over the specified <paramref name="json"/> expression.
        /// </summary>
        /// <param name="json">The JSON expression to read.</param>
        public JsonExpressionReader(Expression json)
        {
            if (json == null)
            {
                throw new ArgumentNullException(nameof(json));
            }

            _tokens = new TokenStack();
            _tokens.Push(new Token {
                Expression = json
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new JSON reader over the specified <paramref name="json"/> expression.
        /// </summary>
        /// <param name="json">The JSON expression to read.</param>
        /// <param name="pool">Resource pool to use for reuse of commonly allocated data structures.</param>
        public JsonExpressionReader(Expression json, JsonInteropResourcePool pool)
        {
            if (json == null)
            {
                throw new ArgumentNullException(nameof(json));
            }

            _pool   = pool ?? throw new ArgumentNullException(nameof(pool));
            _tokens = _pool.Pool.Allocate();
            _tokens.Push(new Token {
                Expression = json
            });
        }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a new JSON expression writer.
 /// </summary>
 /// <param name="pool">Resource pool to use for reuse of commonly allocated data structures.</param>
 public JsonExpressionWriter(JsonInteropResourcePool pool)
 {
     _pool   = pool ?? throw new ArgumentNullException(nameof(pool));
     _tokens = _pool.Pool.Allocate();
 }