ToString() 공개 메소드

Serialization to a string
public ToString ( ) : string
리턴 string
        public static string ToString(DateTime value, XmlDateTimeSerializationMode dateTimeOption)
        {
            switch (dateTimeOption)
            {
                case XmlDateTimeSerializationMode.Local:
                    value = SwitchToLocalTime(value);
                    break;

                case XmlDateTimeSerializationMode.Utc:
                    value = SwitchToUtcTime(value);
                    break;

                case XmlDateTimeSerializationMode.Unspecified:
                    value = new DateTime(value.Ticks, DateTimeKind.Unspecified);
                    break;

                case XmlDateTimeSerializationMode.RoundtripKind:
                    break;

                default:
                    throw new ArgumentException(Res.GetString("Sch_InvalidDateTimeOption", new object[] { dateTimeOption, "dateTimeOption" }));
            }
            XsdDateTime time = new XsdDateTime(value, XsdDateTimeFlags.DateTime);
            return time.ToString();
        }
예제 #2
0
        protected static string TimeToString(DateTime value)
        {
            XsdDateTime time = new XsdDateTime(value, XsdDateTimeFlags.Time);

            return(time.ToString());
        }
 public static string ToString(DateTimeOffset value)
 {
     XsdDateTime time = new XsdDateTime(value);
     return time.ToString();
 }
예제 #4
0
        protected static string GYearMonthToString(DateTime value)
        {
            XsdDateTime time = new XsdDateTime(value, XsdDateTimeFlags.GYearMonth);

            return(time.ToString());
        }
예제 #5
0
        protected static string GYearOffsetToString(DateTimeOffset value)
        {
            XsdDateTime time = new XsdDateTime(value, XsdDateTimeFlags.GYear);

            return(time.ToString());
        }
예제 #6
0
파일: XmlConvert.cs 프로젝트: dotnet/corefx
        ///<include file='doc\XmlConvert.uex' path='docs/doc[@for="XmlConvert.ToString14"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public static string ToString(DateTime value, XmlDateTimeSerializationMode dateTimeOption)
        {
            switch (dateTimeOption)
            {
                case XmlDateTimeSerializationMode.Local:
                    value = SwitchToLocalTime(value);
                    break;

                case XmlDateTimeSerializationMode.Utc:
                    value = SwitchToUtcTime(value);
                    break;

                case XmlDateTimeSerializationMode.Unspecified:
                    value = new DateTime(value.Ticks, DateTimeKind.Unspecified);
                    break;

                case XmlDateTimeSerializationMode.RoundtripKind:
                    break;

                default:
                    throw new ArgumentException(SR.Format(SR.Sch_InvalidDateTimeOption, dateTimeOption, nameof(dateTimeOption)));
            }
            XsdDateTime xsdDateTime = new XsdDateTime(value, XsdDateTimeFlags.DateTime);
            return xsdDateTime.ToString();
        }
 protected static string TimeToString(DateTime value)
 {
     XsdDateTime time = new XsdDateTime(value, XsdDateTimeFlags.Time);
     return time.ToString();
 }
 protected static string GYearOffsetToString(DateTimeOffset value)
 {
     XsdDateTime time = new XsdDateTime(value, XsdDateTimeFlags.GYear);
     return time.ToString();
 }
 protected static string GYearMonthToString(DateTime value)
 {
     XsdDateTime time = new XsdDateTime(value, XsdDateTimeFlags.GYearMonth);
     return time.ToString();
 }
 protected static string GMonthDayToString(DateTime value)
 {
     XsdDateTime time = new XsdDateTime(value, XsdDateTimeFlags.GMonthDay);
     return time.ToString();
 }