System.Xml.XmlConverter.ToTimeSpan C# (CSharp) Method

ToTimeSpan() static public method

static public ToTimeSpan ( string value ) : System.TimeSpan
value string
return System.TimeSpan
        static public TimeSpan ToTimeSpan(string value)
        {
            try
            {
                return XmlConvert.ToTimeSpan(value);
            }
            catch (ArgumentException exception)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateConversionException(value, "TimeSpan", exception));
            }
            catch (FormatException exception)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateConversionException(value, "TimeSpan", exception));
            }
            catch (OverflowException exception)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateConversionException(value, "TimeSpan", exception));
            }
        }

Same methods

XmlConverter::ToTimeSpan ( byte buffer, int offset, int count ) : System.TimeSpan

Usage Example

示例#1
0
 public TimeSpan ToTimeSpan()
 {
     if (_type == ValueHandleType.TimeSpan)
     {
         return(new TimeSpan(GetInt64()));
     }
     if (_type == ValueHandleType.UTF8)
     {
         return(XmlConverter.ToTimeSpan(_bufferReader.Buffer, _offset, _length));
     }
     return(XmlConverter.ToTimeSpan(GetString()));
 }
All Usage Examples Of System.Xml.XmlConverter::ToTimeSpan