public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { Type type = value.GetType(); PropertyInfo property = type.GetProperty("Key"); PropertyInfo info2 = type.GetProperty("Value"); DefaultContractResolver resolver = serializer.IContractResolver_0 as DefaultContractResolver; writer.WriteStartObject(); writer.WritePropertyName((resolver != null) ? resolver.GetResolvedPropertyName("Key") : "Key"); serializer.Serialize(writer, Class194.smethod_23(property, value)); writer.WritePropertyName((resolver != null) ? resolver.GetResolvedPropertyName("Value") : "Value"); serializer.Serialize(writer, Class194.smethod_23(info2, value)); writer.WriteEndObject(); }
public object GetValue(object target) { object obj2; try { obj2 = Class194.smethod_23(this.memberInfo_0, target); } catch (Exception exception) { throw new JsonSerializationException("Error getting value from '{0}' on '{1}'.".smethod_1(CultureInfo.InvariantCulture, this.memberInfo_0.Name, target.GetType()), exception); } return(obj2); }