Ejemplo n.º 1
0
        /// <summary>
        /// Writes the JSON representation of the object.
        /// </summary>
        /// <param name="writer">The <see cref="JsonWriter"/> to write to.</param>
        /// <param name="value">The value.</param>
        /// <param name="serializer">The calling serializer.</param>
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            if (!(value is EssentialsPartialDate))
            {
                return;
            }
            EssentialsPartialDate date = (EssentialsPartialDate)value;

            writer.WriteValue(date.ToString());
        }
        internal static object ToFormat(EssentialsPartialDate value, TimeFormat format)
        {
            switch (format)
            {
            case TimeFormat.Iso8601:
                return(value.ToString());

            default:
                throw new ArgumentException("Unsupported format " + format, nameof(format));
            }
        }