示例#1
0
 public override void WriteJson(global::Newtonsoft.Json.JsonWriter writer, object value, global::Newtonsoft.Json.JsonSerializer serializer)
 {
     if (value != null)
     {
         MediaType identity = (MediaType)value;
         writer.WriteValue(identity.ToString());
     }
     else
     {
         writer.WriteNull();
     }
 }
示例#2
0
        public override void WriteJson(global::Newtonsoft.Json.JsonWriter writer, [AllowNull] IConfigurationCollection <TElement> value, global::Newtonsoft.Json.JsonSerializer serializer)
        {
            if (ReferenceEquals(value, null))
            {
                writer.WriteNull();
                return;
            }

            writer.WriteStartArray();

            foreach (var item in value)
            {
                if (ReferenceEquals(value, null))
                {
                    writer.WriteNull();
                }
                else
                {
                    serializer.Serialize(writer, item);
                }
            }

            writer.WriteEndArray();
        }
示例#3
0
        public override void WriteJson(global::Newtonsoft.Json.JsonWriter writer, [AllowNull] IConfigurationDictionary <TElement> value, global::Newtonsoft.Json.JsonSerializer serializer)
        {
            if (ReferenceEquals(value, null))
            {
                writer.WriteNull();
                return;
            }

            writer.WriteStartObject();

            foreach (var item in value)
            {
                writer.WritePropertyName(item.Key);
                serializer.Serialize(writer, item.Value);
            }

            writer.WriteEndObject();
        }