public override string ToString(DateTimeOffset value)
        {
            switch (base.TypeCode)
            {
            case XmlTypeCode.Time:
                return(XmlBaseConverter.TimeOffsetToString(value));

            case XmlTypeCode.Date:
                return(XmlBaseConverter.DateOffsetToString(value));

            case XmlTypeCode.GYearMonth:
                return(XmlBaseConverter.GYearMonthOffsetToString(value));

            case XmlTypeCode.GYear:
                return(XmlBaseConverter.GYearOffsetToString(value));

            case XmlTypeCode.GMonthDay:
                return(XmlBaseConverter.GMonthDayOffsetToString(value));

            case XmlTypeCode.GDay:
                return(XmlBaseConverter.GDayOffsetToString(value));

            case XmlTypeCode.GMonth:
                return(XmlBaseConverter.GMonthOffsetToString(value));
            }
            return(XmlBaseConverter.DateTimeOffsetToString(value));
        }
 public override object ChangeType(DateTimeOffset value, Type destinationType)
 {
     if (destinationType == null)
     {
         throw new ArgumentNullException("destinationType");
     }
     if (destinationType == XmlBaseConverter.ObjectType)
     {
         destinationType = base.DefaultClrType;
     }
     if (destinationType == XmlBaseConverter.StringType)
     {
         return(XmlBaseConverter.DateTimeOffsetToString(value));
     }
     return(this.ChangeTypeWildcardSource(value, destinationType, null));
 }
        public override string ToString(object value, IXmlNamespaceResolver nsResolver)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            Type derivedType = value.GetType();

            if (derivedType == XmlBaseConverter.BooleanType)
            {
                return(XmlConvert.ToString((bool)value));
            }
            if (derivedType == XmlBaseConverter.ByteType)
            {
                return(XmlConvert.ToString((byte)value));
            }
            if (derivedType == XmlBaseConverter.ByteArrayType)
            {
                return(XmlBaseConverter.Base64BinaryToString((byte[])value));
            }
            if (derivedType == XmlBaseConverter.DateTimeType)
            {
                return(XmlBaseConverter.DateTimeToString((DateTime)value));
            }
            if (derivedType == XmlBaseConverter.DateTimeOffsetType)
            {
                return(XmlBaseConverter.DateTimeOffsetToString((DateTimeOffset)value));
            }
            if (derivedType == XmlBaseConverter.DecimalType)
            {
                return(XmlConvert.ToString((decimal)value));
            }
            if (derivedType == XmlBaseConverter.DoubleType)
            {
                return(XmlConvert.ToString((double)value));
            }
            if (derivedType == XmlBaseConverter.Int16Type)
            {
                return(XmlConvert.ToString((short)value));
            }
            if (derivedType == XmlBaseConverter.Int32Type)
            {
                return(XmlConvert.ToString((int)value));
            }
            if (derivedType == XmlBaseConverter.Int64Type)
            {
                return(XmlConvert.ToString((long)value));
            }
            if (derivedType == XmlBaseConverter.SByteType)
            {
                return(XmlConvert.ToString((sbyte)value));
            }
            if (derivedType == XmlBaseConverter.SingleType)
            {
                return(XmlConvert.ToString((float)value));
            }
            if (derivedType == XmlBaseConverter.StringType)
            {
                return((string)value);
            }
            if (derivedType == XmlBaseConverter.TimeSpanType)
            {
                return(XmlBaseConverter.DurationToString((TimeSpan)value));
            }
            if (derivedType == XmlBaseConverter.UInt16Type)
            {
                return(XmlConvert.ToString((ushort)value));
            }
            if (derivedType == XmlBaseConverter.UInt32Type)
            {
                return(XmlConvert.ToString((uint)value));
            }
            if (derivedType == XmlBaseConverter.UInt64Type)
            {
                return(XmlConvert.ToString((ulong)value));
            }
            if (XmlBaseConverter.IsDerivedFrom(derivedType, XmlBaseConverter.UriType))
            {
                return(XmlBaseConverter.AnyUriToString((Uri)value));
            }
            if (derivedType == XmlBaseConverter.XmlAtomicValueType)
            {
                return((string)((XmlAtomicValue)value).ValueAs(XmlBaseConverter.StringType, nsResolver));
            }
            if (XmlBaseConverter.IsDerivedFrom(derivedType, XmlBaseConverter.XmlQualifiedNameType))
            {
                return(XmlBaseConverter.QNameToString((XmlQualifiedName)value, nsResolver));
            }
            return((string)this.ChangeTypeWildcardDestination(value, XmlBaseConverter.StringType, nsResolver));
        }
 public override string ToString(DateTimeOffset value)
 {
     return(XmlBaseConverter.DateTimeOffsetToString(value));
 }