YearMonthDuration StructureYearMonthDuration StructureYearMonthDuration Structure

Represents a duration of time that is expressed by the Gregorian year and month components. The corresponding XML Schema type is xs:yearMonthDuration.

Syntax

Public NotInheritable  YearMonthDuration _
        Implements IComparable(Of YearMonthDuration), _
                   IEquatable(Of YearMonthDuration)
public sealed  YearMonthDuration : IComparable<YearMonthDuration>,
        IEquatable<YearMonthDuration>
public:
value class YearMonthDuration sealed : IComparable<YearMonthDuration>,
        IEquatable<YearMonthDuration>
 
The YearMonthDurationYearMonthDurationYearMonthDuration type exposes the following members.

Constructors

 ConstructorDescription
Public methodYearMonthDuration (int, int)YearMonthDuration (Integer, Integer)YearMonthDuration (int, int) Initializes a new instance of the YearMonthDurationYearMonthDurationYearMonthDuration structure with the specified duration in years and months.
Public methodYearMonthDuration (long)YearMonthDuration (Long)YearMonthDuration (long) Initializes a new instance of the YearMonthDurationYearMonthDurationYearMonthDuration structure with the specified duration in months.

Top

Properties

 PropertyDescription
Public propertyMonthsMonthsMonths Gets the months component of the current YearMonthDurationYearMonthDurationYearMonthDuration.
Public propertyTotalMonthsTotalMonthsTotalMonths Gets the value of the current YearMonthDurationYearMonthDurationYearMonthDuration expressed as a number of months.
Public propertyYearsYearsYears Gets the years component of the current YearMonthDurationYearMonthDurationYearMonthDuration.

Top

Methods

 MethodDescription
Public methodstaticAddAddAdd Adds two specified YearMonthDurationYearMonthDurationYearMonthDuration values.
Public methodstaticCompareCompareCompare Compares two specified YearMonthDurationYearMonthDurationYearMonthDuration values.
Public methodCompareToCompareToCompareTo Compares this instance to a specified YearMonthDurationYearMonthDurationYearMonthDuration and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified YearMonthDurationYearMonthDurationYearMonthDuration.
Public methodstaticDivide (YearMonthDuration, double)Divide (YearMonthDuration, Double)Divide (YearMonthDuration, double) Divides the specified YearMonthDurationYearMonthDurationYearMonthDuration value by a doubleDoubledouble value.
Public methodstaticDivide (YearMonthDuration, YearMonthDuration)Divide (YearMonthDuration, YearMonthDuration)Divide (YearMonthDuration, YearMonthDuration) Divides the specified YearMonthDurationYearMonthDurationYearMonthDuration value by another YearMonthDurationYearMonthDurationYearMonthDuration value.
Public methodEquals (object)Equals (Object)Equals (object^) Determines whether this instance is equal to a specified object. (Overrides ValueType.EqualsValueType.EqualsValueType::Equals)
Public methodEquals (YearMonthDuration)Equals (YearMonthDuration)Equals (YearMonthDuration) Indicates whether this instance is equal to another YearMonthDurationYearMonthDurationYearMonthDuration.
Protected methodObject.FinalizeObject.FinalizeObject::Finalize Allows an objectObjectobject to attempt to free resources and perform other cleanup operations before the objectObjectobject is reclaimed by garbage collection. (Inherited from System.ObjectSystem.ObjectSystem::Object)
Public methodGetHashCodeGetHashCodeGetHashCode Returns the hash code for this instance. (Overrides ValueType.GetHashCodeValueType.GetHashCodeValueType::GetHashCode)
Public methodObject.GetTypeObject.GetTypeObject::GetType Gets the TypeTypeType of the current instance. (Inherited from System.ObjectSystem.ObjectSystem::Object)
Protected methodObject.MemberwiseCloneObject.MemberwiseCloneObject::MemberwiseClone Creates a shallow copy of the current objectObjectobject. (Inherited from System.ObjectSystem.ObjectSystem::Object)
Public methodstaticMultiply (double, YearMonthDuration)Multiply (Double, YearMonthDuration)Multiply (double, YearMonthDuration) Multiplies the specified YearMonthDurationYearMonthDurationYearMonthDuration value by a doubleDoubledouble value.
Public methodstaticMultiply (YearMonthDuration, double)Multiply (YearMonthDuration, Double)Multiply (YearMonthDuration, double) Multiplies the specified YearMonthDurationYearMonthDurationYearMonthDuration value by a doubleDoubledouble value.
Public methodstaticNegateNegateNegate Negates the value of the specified YearMonthDurationYearMonthDurationYearMonthDuration operand.
Public methodstaticParseParseParse Converts a lexical representation of an xs:yearMonthDuration to its YearMonthDurationYearMonthDurationYearMonthDuration equivalent.
Public methodstaticPlusPlusPlus Returns the value of the YearMonthDurationYearMonthDurationYearMonthDuration operand (the sign of the operand is unchanged).
Public methodstaticSubtractSubtractSubtract Subtracts a YearMonthDurationYearMonthDurationYearMonthDuration value from another YearMonthDurationYearMonthDurationYearMonthDuration value.
Public methodToStringToStringToString Returns the canonical lexical representation of this YearMonthDurationYearMonthDurationYearMonthDuration. (Overrides ValueType.ToStringValueType.ToStringValueType::ToString)
Public methodstaticTryParseTryParseTryParse Converts a lexical representation of an xs:yearMonthDuration to its YearMonthDurationYearMonthDurationYearMonthDuration equivalent. A return value indicates whether the conversion succeeded or failed.

Top

Operators

 OperatorDescription
Public operatorstaticAdditionAdditionAddition Adds two specified YearMonthDurationYearMonthDurationYearMonthDuration values.
Public operatorstaticDivision (YearMonthDuration, double)Division (YearMonthDuration, Double)Division (YearMonthDuration, double) Divides the specified YearMonthDurationYearMonthDurationYearMonthDuration value by a doubleDoubledouble value.
Public operatorstaticDivision (YearMonthDuration, YearMonthDuration)Division (YearMonthDuration, YearMonthDuration)Division (YearMonthDuration, YearMonthDuration) Divides the specified YearMonthDurationYearMonthDurationYearMonthDuration value by another YearMonthDurationYearMonthDurationYearMonthDuration value.
Public operatorstaticEqualityEqualityEquality Indicates whether a specified YearMonthDurationYearMonthDurationYearMonthDuration is equal to another specified YearMonthDurationYearMonthDurationYearMonthDuration.
Public operatorstaticGreaterThanGreaterThanGreaterThan Indicates whether a specified YearMonthDurationYearMonthDurationYearMonthDuration is greater than another specified YearMonthDurationYearMonthDurationYearMonthDuration.
Public operatorstaticGreaterThanOrEqualGreaterThanOrEqualGreaterThanOrEqual Indicates whether a specified YearMonthDurationYearMonthDurationYearMonthDuration is greater than or equal to another specified YearMonthDurationYearMonthDurationYearMonthDuration.
Public operatorstaticInequalityInequalityInequality Indicates whether a specified YearMonthDurationYearMonthDurationYearMonthDuration is not equal to another specified YearMonthDurationYearMonthDurationYearMonthDuration.
Public operatorstaticLessThanLessThanLessThan Indicates whether a specified YearMonthDurationYearMonthDurationYearMonthDuration is less than another specified YearMonthDurationYearMonthDurationYearMonthDuration.
Public operatorstaticLessThanOrEqualLessThanOrEqualLessThanOrEqual Indicates whether a specified YearMonthDurationYearMonthDurationYearMonthDuration is less than or equal to another specified YearMonthDurationYearMonthDurationYearMonthDuration.
Public operatorstaticMultiply (double, YearMonthDuration)Multiply (Double, YearMonthDuration)Multiply (double, YearMonthDuration) Multiplies the specified YearMonthDurationYearMonthDurationYearMonthDuration value by a doubleDoubledouble value.
Public operatorstaticMultiply (YearMonthDuration, double)Multiply (YearMonthDuration, Double)Multiply (YearMonthDuration, double) Multiplies the specified YearMonthDurationYearMonthDurationYearMonthDuration value by a doubleDoubledouble value.
Public operatorstaticSubtractionSubtractionSubtraction Subtracts a YearMonthDurationYearMonthDurationYearMonthDuration value from another YearMonthDurationYearMonthDurationYearMonthDuration value.
Public operatorstaticUnaryNegationUnaryNegationUnaryNegation Negates the value of the specified YearMonthDurationYearMonthDurationYearMonthDuration operand.
Public operatorstaticUnaryPlusUnaryPlusUnaryPlus Returns the value of the YearMonthDurationYearMonthDurationYearMonthDuration operand (the sign of the operand is unchanged).

Top

Fields

 FieldDescription
Public fieldstaticMaxValueMaxValueMaxValue Represents the maximum YearMonthDurationYearMonthDurationYearMonthDuration representable value. This field is read-only.
Public fieldstaticMinValueMinValueMinValue Represents the minimum representable YearMonthDurationYearMonthDurationYearMonthDuration value. This field is read-only.

Top

Remarks

A YearMonthDurationYearMonthDurationYearMonthDuration is a duration of time that is expressed by the Gregorian year and month. It can be used to represent a period of months, regardless of the number of days in a month. To say, for example, that a season lasts three months.

Unlike DurationDurationDuration values, YearMonthDurationYearMonthDurationYearMonthDuration values can be totally ordered.