Beispiel #1
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }

            if (objectType == null)
            {
                throw new ArgumentNullException(nameof(objectType));
            }

            JToken jToken     = ((JTokenReader)reader).CurrentToken;
            string methodName = jToken["NodeType"].Value <string>();

            var binaryMethod = JsonSerializerHelpers.GetExpressionCreatorMethodInfo(jToken);

            var leftMethod = jToken["Left"].ToObject(typeof(Expression));

            //BinaryExpression expression = binaryMethod.Invoke(null, jToken["Left"])

            return(binaryMethod);
        }
Beispiel #2
0
 public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
 {
     JsonSerializerHelpers.OptInWriteJson(writer, value, serializer, true);
 }