Exemplo n.º 1
0
 protected ConditionalExpression MakeSureBlockStartsWith(ParameterExpression jsonReaderParam, char c)
 {
     return(Expression.IfThen(
                Expression.NotEqual(
                    Expression.Call(jsonReaderParam, ExpressionReflector.GetMethodInfo <JsonReader>(r => r.CurrentChar())),
                    Expression.Constant(c)),
                Expression.Throw(
                    Expression.New(
                        ExpressionReflector.GetConstructorInfo(() => new JsonReadException(null, null)),
                        Expression.Constant($"Input is not a valid Json: '{c}' expected."),
                        Expression.Default(typeof(Exception))))));
 }