C# Class System.Xml.Schema.XsdDuration

This structure holds components of an Xsd Duration. It is used internally to support Xsd durations without loss of fidelity. XsdDuration structures are immutable once they've been created.
Mostra file Open project: gbarnett/shared-source-cli-2.0 Class Usage Examples

Public Methods

Method Description
Normalize ( ) : XsdDuration

Normalize year-month part and day-time part so that month < 12, hour < 24, minute < 60, and second < 60.

ToString ( ) : string

Return the string representation of this Xsd duration.

ToTimeSpan ( ) : System.TimeSpan

Internal helper method that converts an Xsd duration to a TimeSpan value. This code uses the estimate that there are 365 days in the year and 30 days in a month.

XsdDuration ( System.TimeSpan timeSpan ) : System

Construct an XsdDuration from a TimeSpan value.

XsdDuration ( bool isNegative, int years, int months, int days, int hours, int minutes, int seconds, int nanoseconds ) : System

Construct an XsdDuration from component parts.

XsdDuration ( string s ) : System

Constructs an XsdDuration from a string in the xsd:duration format. Components are stored with loss of fidelity (except in the case of overflow).

XsdDuration ( string s, DurationType durationType ) : System

Constructs an XsdDuration from a string in the xsd:duration format. Components are stored without loss of fidelity (except in the case of overflow).

Private Methods

Method Description
ToString ( DurationType durationType ) : string

Return the string representation according to xsd:duration rules, xdt:dayTimeDuration rules, or xdt:yearMonthDuration rules.

ToTimeSpan ( DurationType durationType ) : System.TimeSpan

Internal helper method that converts an Xsd duration to a TimeSpan value. This code uses the estimate that there are 365 days in the year and 30 days in a month.

TryParse ( string s, DurationType durationType, XsdDuration &result ) : Exception
TryParse ( string s, XsdDuration &result ) : Exception
TryParseDigits ( string s, int &offset, bool eatDigits, int &result, int &numDigits ) : string
TryToTimeSpan ( DurationType durationType, System.TimeSpan &result ) : Exception
TryToTimeSpan ( System.TimeSpan &result ) : Exception
XsdDuration ( System.TimeSpan timeSpan, DurationType durationType ) : System

Construct an XsdDuration from a TimeSpan value that represents an xsd:duration, an xdt:dayTimeDuration, or an xdt:yearMonthDuration.

Method Details

Normalize() public method

Normalize year-month part and day-time part so that month < 12, hour < 24, minute < 60, and second < 60.
public Normalize ( ) : XsdDuration
return XsdDuration

ToString() public method

Return the string representation of this Xsd duration.
public ToString ( ) : string
return string

ToTimeSpan() public method

Internal helper method that converts an Xsd duration to a TimeSpan value. This code uses the estimate that there are 365 days in the year and 30 days in a month.
public ToTimeSpan ( ) : System.TimeSpan
return System.TimeSpan

XsdDuration() public method

Construct an XsdDuration from a TimeSpan value.
public XsdDuration ( System.TimeSpan timeSpan ) : System
timeSpan System.TimeSpan
return System

XsdDuration() public method

Construct an XsdDuration from component parts.
public XsdDuration ( bool isNegative, int years, int months, int days, int hours, int minutes, int seconds, int nanoseconds ) : System
isNegative bool
years int
months int
days int
hours int
minutes int
seconds int
nanoseconds int
return System

XsdDuration() public method

Constructs an XsdDuration from a string in the xsd:duration format. Components are stored with loss of fidelity (except in the case of overflow).
public XsdDuration ( string s ) : System
s string
return System

XsdDuration() public method

Constructs an XsdDuration from a string in the xsd:duration format. Components are stored without loss of fidelity (except in the case of overflow).
public XsdDuration ( string s, DurationType durationType ) : System
s string
durationType DurationType
return System