Class convertinf Source objects to string and the other way.
Ejemplo n.º 1
0
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            var source = (Source)value;

            writer.WriteValue(SourceEnumStringConverter.GetString(source));
        }
Ejemplo n.º 2
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            var enumString = (string)reader.Value;

            return(SourceEnumStringConverter.GetSource(enumString));
        }