Exemple #1
0
        public void WritePropertyName(JsonPropertyName propertyName)
        {
            if (propertyName is null)
            {
                throw new ArgumentNullException(nameof(propertyName));
            }

            WriteStarted(InternalState.PropertyName);
            WriteUTFBytes(propertyName.GetBytes(Settings.NamingStrategy));
        }
Exemple #2
0
        static EnumHelper()
        {
            foreach (T value in Enum.GetValues(typeof(T)))
            {
                var propertyName = JsonPropertyName.GetOrCreate(value.ToString());

                s_propertyNames.Add(value, propertyName);
                s_propertyNamesReversed.Add(propertyName.Value, value);
            }
        }
Exemple #3
0
        public static void Write(this JsonWriter writer, JsonPropertyName propertyName, UInt32?value)
        {
            if (!value.HasValue && !writer.Settings.SerializeNulls)
            {
                return;
            }

            writer.WritePropertyName(propertyName);
            writer.WriteValue(value);
        }
Exemple #4
0
        public static void Write <T>(this JsonWriter writer, JsonPropertyName propertyName, T value)
        {
            if (value == null && !writer.Settings.SerializeNulls)
            {
                return;
            }

            writer.WritePropertyName(propertyName);
            writer.WriteValue(value);
        }
Exemple #5
0
 public static void Write(this JsonWriter writer, JsonPropertyName propertyName, UInt32 value)
 {
     writer.WritePropertyName(propertyName);
     writer.WriteValue(value);
 }
Exemple #6
0
 public static void Write(this JsonWriter writer, JsonPropertyName propertyName, DateTimeOffset value)
 {
     writer.WritePropertyName(propertyName);
     writer.WriteValue(value);
 }