示例#1
0
        public static string ToDateTimeFormat(DateTimeKind kind)
        {
            switch (kind)
            {
            case DateTimeKind.Local:
                return(IsoDateFormat);

            case DateTimeKind.Unspecified:
                return("yyyy-MM-ddTHH:mm:ss.FFFFFFF");

            case DateTimeKind.Utc:
                return("yyyy-MM-ddTHH:mm:ss.FFFFFFFZ");

            default:
                throw MiscellaneousUtils.CreateArgumentOutOfRangeException(nameof(kind), kind, "Unexpected DateTimeKind value.");
            }
        }
示例#2
0
        public static XmlDateTimeSerializationMode ToSerializationMode(DateTimeKind kind)
        {
            switch (kind)
            {
            case DateTimeKind.Local:
                return(XmlDateTimeSerializationMode.Local);

            case DateTimeKind.Unspecified:
                return(XmlDateTimeSerializationMode.Unspecified);

            case DateTimeKind.Utc:
                return(XmlDateTimeSerializationMode.Utc);

            default:
                throw MiscellaneousUtils.CreateArgumentOutOfRangeException(nameof(kind), kind, "Unexpected DateTimeKind value.");
            }
        }