Struct Duration
  
Represents a fixed (and calendar-independent) length of time.
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  
    Implements
    
    
    IComparable
    IXmlSerializable
    IFormattable
    ISerializable
   
  
    Inherited Members
    
      Object.Equals(Object, Object)
    
    
      Object.ReferenceEquals(Object, Object)
    
    
      Object.GetType()
    
   
  
  Assembly: NodaTime.dll
  Syntax
  
    [Serializable]
public struct Duration : IEquatable<Duration>, IComparable<Duration>, IComparable, IXmlSerializable, IFormattable, ISerializable
   
  
  
  Properties
  
  BclCompatibleTicks
  
Gets the total number of ticks in the duration as a 64-bit integer, truncating towards zero where necessary.
  
  
  Since 1.4.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public long BclCompatibleTicks { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Int64 | The total number of ticks in the duration. | 
    
  
  
  
  Exceptions
  
    
      
        | Type | Condition | 
    
    
      
        | System.OverflowException | The number of ticks cannot be represented a signed 64-bit integer. | 
    
  
  See Also
  
  
  Days
  
Gets the whole number of standard (24 hour) days within this duration. This is truncated towards zero;
for example, "-1.75 days" and "1.75 days" would have results of -1 and 1 respectively.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Int32 | The whole number of days in the duration | 
    
  
  
  Epsilon
  
Gets a 
Duration value equal to 1 nanosecond; the smallest amount by which an instant can vary.
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration Epsilon { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A duration representing 1 nanosecond. | 
    
  
  
  Hours
  
The hour component of this duration, in the range [-23, 23], truncated towards zero.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public int Hours { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Int32 | The hour component of the duration, within the day. | 
    
  
  
  MaxValue
  
Gets the maximum value supported by 
Duration.
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration MaxValue { get; }
   
  Property Value
  
  
  Milliseconds
  
Gets the subsecond component of this duration, expressed in milliseconds, in the range [-999, 999] and truncated towards zero.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public int Milliseconds { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Int32 | The subsecond component of the duration, in milliseconds. | 
    
  
  
  Minutes
  
The minute component of this duration, in the range [-59, 59], truncated towards zero.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public int Minutes { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Int32 | The minute component of the duration, within the hour. | 
    
  
  
  MinValue
  
Gets the minimum (largest negative) value supported by 
Duration.
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration MinValue { get; }
   
  Property Value
  
  
  NanosecondOfDay
  
Gets the number of nanoseconds within the day of this duration. For negative durations, this
will be negative (or zero).
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public long NanosecondOfDay { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Int64 | The number of nanoseconds within the day of this duration. | 
    
  
  
  Seconds
  
Gets the second component of this duration, in the range [-59, 59], truncated towards zero.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public int Seconds { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Int32 | The second component of the duration, within the minute. | 
    
  
  
  SubsecondNanoseconds
  
Gets the subsecond component of this duration, expressed in nanoseconds, in the range [-999999999, 999999999].
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public int SubsecondNanoseconds { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Int32 | The subsecond component of the duration, in nanoseconds. | 
    
  
  
  SubsecondTicks
  
Gets the subsecond component of this duration, expressed in ticks, in the range [-9999999, 9999999] and truncated towards zero.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public int SubsecondTicks { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Int32 | The subsecond component of the duration, in ticks. | 
    
  
  
  TotalDays
  
Gets the total number of days in this duration, as a System.Double.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public double TotalDays { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Double | The total number of days in this duration. | 
    
  
  
  
  
  TotalHours
  
Gets the total number of hours in this duration, as a System.Double.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public double TotalHours { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Double | The total number of hours in this duration. | 
    
  
  
  
  
  TotalMilliseconds
  
Gets the total number of milliseconds in this duration, as a System.Double.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public double TotalMilliseconds { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Double | The total number of milliseconds in this duration. | 
    
  
  
  
  
  TotalMinutes
  
Gets the total number of minutes in this duration, as a System.Double.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public double TotalMinutes { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Double | The total number of minutes in this duration. | 
    
  
  
  
  
  TotalNanoseconds
  
Gets the total number of nanoseconds in this duration, as a System.Double.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public double TotalNanoseconds { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Double | This duration as a number of nanoseconds, represented as a Double. | 
    
  
  
  
  
  TotalSeconds
  
Gets the total number of seconds in this duration, as a System.Double.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public double TotalSeconds { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Double | The total number of seconds in this duration. | 
    
  
  
  
  
  TotalTicks
  
Gets the total number of ticks in this duration, as a System.Double.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public double TotalTicks { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | Double | The total number of ticks in this duration. | 
    
  
  
  
  See Also
  
  
  Zero
  
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration Zero { get; }
   
  Property Value
  
  Methods
  
  Add(Duration, Duration)
  
Adds one duration to another. Friendly alternative to operator+().
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration Add(Duration left, Duration right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Duration | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration representing the sum of the given values. | 
    
  
  
  CompareTo(Duration)
  
Compares the current object with another object of the same type.
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public int CompareTo(Duration other)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | other | An object to compare with this object. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Int32 | A 32-bit signed integer that indicates the relative order of the objects being compared.
The return value has the following meanings: | Value | Meaning | 
|---|
 | < 0 | This object is less than the otherparameter. |  | 0 | This object is equal to other. |  | > 0 | This object is greater than other. | 
 | 
    
  
  
  Divide(Duration, Duration)
  
Divides one duration by another. Friendly alternative to operator/().
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static double Divide(Duration left, Duration right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Duration | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Double | The System.Double representing the result of dividing leftbyright. | 
    
  
  
  Divide(Duration, Double)
  
Divides a duration by a System.Double. Friendly alternative to operator/().
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration Divide(Duration left, double right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Double | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration representing the result of dividing leftbyright. | 
    
  
  
  Divide(Duration, Int64)
  
Divides a duration by an System.Int64. Friendly alternative to operator/().
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration Divide(Duration left, long right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Int64 | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration representing the result of dividing leftbyright. | 
    
  
  
  Equals(Duration)
  
Indicates whether the current object is equal to another object of the same type.
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public bool Equals(Duration other)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | other | An object to compare with this object. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Boolean | true if the current object is equal to the otherparameter;
otherwise, false. | 
    
  
  
  Equals(Object)
  
Determines whether the specified System.Object is equal to this instance.
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public override bool Equals(object obj)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Object | obj | The System.Object to compare with this instance. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Boolean | trueif the specified System.Object is equal to this instance;
otherwise,false. | 
    
  
  Overrides
  System.ValueType.Equals(System.Object)
  
  FromDays(Double)
  
Returns a 
Duration that represents the given number of days, assuming a 'standard' 24-hour
day.
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration FromDays(double days)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Double | days | The number of days. | 
    
  
  Returns
  
  
  FromDays(Int32)
  
Returns a 
Duration that represents the given number of days, assuming a 'standard' 24-hour
day.
  Since 1.4.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration FromDays(int days)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Int32 | days | The number of days. | 
    
  
  Returns
  
  
  FromHours(Double)
  
Returns a 
Duration that represents the given number of hours.
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration FromHours(double hours)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Double | hours | The number of hours. | 
    
  
  Returns
  
  
  FromHours(Int32)
  
Returns a 
Duration that represents the given number of hours.
  Since 1.4.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration FromHours(int hours)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Int32 | hours | The number of hours. | 
    
  
  Returns
  
  
  FromMilliseconds(Double)
  
Returns a 
Duration that represents the given number of milliseconds.
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration FromMilliseconds(double milliseconds)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Double | milliseconds | The number of milliseconds. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A Duration representing the given number of milliseconds. | 
    
  
  
  FromMilliseconds(Int64)
  
Returns a 
Duration that represents the given number of milliseconds.
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration FromMilliseconds(long milliseconds)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Int64 | milliseconds | The number of milliseconds. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A Duration representing the given number of milliseconds. | 
    
  
  
  FromMinutes(Double)
  
Returns a 
Duration that represents the given number of minutes.
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration FromMinutes(double minutes)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Double | minutes | The number of minutes. | 
    
  
  Returns
  
  
  FromMinutes(Int64)
  
Returns a 
Duration that represents the given number of minutes.
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration FromMinutes(long minutes)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Int64 | minutes | The number of minutes. | 
    
  
  Returns
  
  
  FromNanoseconds(Double)
  
Converts a number of nanoseconds expressed as a System.Double into a duration. Any fractional
parts of the value are truncated towards zero.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration FromNanoseconds(double nanoseconds)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Double | nanoseconds | The number of nanoseconds to represent. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A duration with the given number of nanoseconds. | 
    
  
  
  FromNanoseconds(Int64)
  
Returns a 
Duration that represents the given number of nanoseconds.
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration FromNanoseconds(long nanoseconds)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Int64 | nanoseconds | The number of nanoseconds. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A Duration representing the given number of nanoseconds. | 
    
  
  
  FromNanoseconds(BigInteger)
  
Converts a number of nanoseconds expressed as a System.Numerics.BigInteger into a duration.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration FromNanoseconds(BigInteger nanoseconds)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | BigInteger | nanoseconds | The number of nanoseconds to represent. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A duration with the given number of nanoseconds. | 
    
  
  
  FromSeconds(Double)
  
Returns a 
Duration that represents the given number of seconds.
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration FromSeconds(double seconds)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Double | seconds | The number of seconds. | 
    
  
  Returns
  
  
  FromSeconds(Int64)
  
Returns a 
Duration that represents the given number of seconds.
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration FromSeconds(long seconds)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Int64 | seconds | The number of seconds. | 
    
  
  Returns
  
  
  FromTicks(Double)
  
Returns a 
Duration that represents the given number of ticks.
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration FromTicks(double ticks)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Double | ticks | The number of ticks. | 
    
  
  Returns
  
  
  FromTicks(Int64)
  
Returns a 
Duration that represents the given number of ticks.
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration FromTicks(long ticks)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Int64 | ticks | The number of ticks. | 
    
  
  Returns
  
  
  FromTimeSpan(TimeSpan)
  
Returns a 
Duration that represents the same number of ticks as the
given 
System.TimeSpan.
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration FromTimeSpan(TimeSpan timeSpan)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | TimeSpan | timeSpan | The TimeSpan value to convert | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration with the same number of ticks as the given TimeSpan. | 
    
  
  
  GetHashCode()
  
Returns a hash code for this instance.
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public override int GetHashCode()
   
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Int32 | A hash code for this instance, suitable for use in hashing algorithms and data
structures like a hash table. | 
    
  
  Overrides
  System.ValueType.GetHashCode()
  
  Minus(Duration)
  
Returns the result of subtracting another duration from this one, for a fluent alternative to operator-().
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public Duration Minus(Duration other)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | other | The duration to subtract | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration representing the result of the subtraction. | 
    
  
  
  Multiply(Duration, Double)
  
Multiplies a duration by a number. Friendly alternative to operator*().
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration Multiply(Duration left, double right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Double | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration representing the product of the given values. | 
    
  
  
  Multiply(Duration, Int64)
  
Multiplies a duration by a number. Friendly alternative to operator*().
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration Multiply(Duration left, long right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Int64 | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration representing the product of the given values. | 
    
  
  
  Multiply(Int64, Duration)
  
Multiplies a duration by a number. Friendly alternative to operator*().
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration Multiply(long left, Duration right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Int64 | left | The left hand side of the operator. | 
      
        | Duration | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration representing the product of the given values. | 
    
  
  
  Negate(Duration)
  
Implements a friendly alternative to the unary negation operator.
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration Negate(Duration duration)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | duration | Duration to negate | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | The negative value of this duration | 
    
  
  
  Plus(Duration)
  
Returns the result of adding another duration to this one, for a fluent alternative to operator+().
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public Duration Plus(Duration other)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | other | The duration to add | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration representing the result of the addition. | 
    
  
  
  Subtract(Duration, Duration)
  
Subtracts one duration from another. Friendly alternative to operator-().
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration Subtract(Duration left, Duration right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Duration | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration representing the difference of the given values. | 
    
  
  
  ToBigIntegerNanoseconds()
  
Conversion to a System.Numerics.BigInteger number of nanoseconds, as a convenient built-in numeric
type which can always represent values in the range we need.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public BigInteger ToBigIntegerNanoseconds()
   
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | BigInteger | This duration as a number of nanoseconds, represented as a BigInteger. | 
    
  
  
  ToInt64Nanoseconds()
  
Conversion to an System.Int64 number of nanoseconds. This will fail if the number of nanoseconds is
out of the range of Int64, which is approximately 292 years (positive or negative).
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public long ToInt64Nanoseconds()
   
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Int64 | This duration as a number of nanoseconds, represented as an Int64. | 
    
  
  Exceptions
  
    
      
        | Type | Condition | 
    
    
      
        | System.OverflowException | The number of nanoseconds is outside the representable range. | 
    
  
  
  ToString()
  
Returns a System.String that represents this instance.
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public override string ToString()
   
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | String | The value of the current instance in the default format pattern ("o"), using the current thread's
culture to obtain a format provider. | 
    
  
  Overrides
  System.ValueType.ToString()
  
  
  
Formats the value of the current instance using the specified pattern.
  
  
  Since 1.2.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public string ToString(string patternText, IFormatProvider formatProvider)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | patternText | The System.String specifying the pattern to use,
or null to use the default format pattern ("o"). | 
      
        | IFormatProvider | formatProvider | The System.IFormatProvider to use when formatting the value,
or null to use the current thread's culture to obtain a format provider. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | String | A System.String containing the value of the current instance in the specified format. | 
    
  
  
  ToTimeSpan()
  
Returns a 
System.TimeSpan that represents the same number of ticks as this
Duration.
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public TimeSpan ToTimeSpan()
   
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | TimeSpan | A new TimeSpan with the same number of ticks as this Duration. | 
    
  
  
  
  Exceptions
  
    
      
        | Type | Condition | 
    
    
      
        | System.OverflowException | The number of ticks cannot be represented a signed 64-bit integer. | 
    
  
  Operators
  
  Addition(Duration, Duration)
  
Implements the operator + (addition).
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration operator +(Duration left, Duration right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Duration | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration representing the sum of the given values. | 
    
  
  
  Division(Duration, Duration)
  
Implements the operator / (division) to divide one duration by another.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static double operator /(Duration left, Duration right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Duration | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Double | The System.Double representing the result of dividing leftbyright. | 
    
  
  
  Division(Duration, Double)
  
Implements the operator / (division) to divide a duration by a System.Double.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration operator /(Duration left, double right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Double | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration representing the result of dividing leftbyright. | 
    
  
  
  Division(Duration, Int64)
  
Implements the operator / (division) to divide a duration by an System.Int64.
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration operator /(Duration left, long right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Int64 | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration representing the result of dividing leftbyright. | 
    
  
  
  Equality(Duration, Duration)
  
Implements the operator == (equality).
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static bool operator ==(Duration left, Duration right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Duration | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Boolean | trueif values are equal to each other, otherwisefalse. | 
    
  
  
  GreaterThan(Duration, Duration)
  
Implements the operator > (greater than).
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static bool operator>(Duration left, Duration right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Duration | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Boolean | trueif the left value is greater than the right value, otherwisefalse. | 
    
  
  
  GreaterThanOrEqual(Duration, Duration)
  
Implements the operator >= (greater than or equal).
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static bool operator >=(Duration left, Duration right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Duration | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Boolean | trueif the left value is greater than or equal to the right value, otherwisefalse. | 
    
  
  
  Inequality(Duration, Duration)
  
Implements the operator != (inequality).
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static bool operator !=(Duration left, Duration right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Duration | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Boolean | trueif values are not equal to each other, otherwisefalse. | 
    
  
  
  LessThan(Duration, Duration)
  
Implements the operator < (less than).
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static bool operator <(Duration left, Duration right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Duration | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Boolean | trueif the left value is less than the right value, otherwisefalse. | 
    
  
  
  LessThanOrEqual(Duration, Duration)
  
Implements the operator <= (less than or equal).
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static bool operator <=(Duration left, Duration right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Duration | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Boolean | trueif the left value is less than or equal to the right value, otherwisefalse. | 
    
  
  
  Multiply(Duration, Double)
  
Implements the operator * (multiplication).
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration operator *(Duration left, double right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Double | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration representing the result of multiplying leftbyright. | 
    
  
  
  Multiply(Duration, Int64)
  
Implements the operator * (multiplication).
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration operator *(Duration left, long right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Int64 | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration representing the result of multiplying leftbyright. | 
    
  
  
  Multiply(Int64, Duration)
  
Implements the operator * (multiplication).
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration operator *(long left, Duration right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Int64 | left | The left hand side of the operator. | 
      
        | Duration | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration representing the result of multiplying leftbyright. | 
    
  
  
  Subtraction(Duration, Duration)
  
Implements the operator - (subtraction).
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration operator -(Duration left, Duration right)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | left | The left hand side of the operator. | 
      
        | Duration | right | The right hand side of the operator. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | A new Duration representing the difference of the given values. | 
    
  
  
  UnaryNegation(Duration)
  
Implements the unary negation operator.
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    public static Duration operator -(Duration duration)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Duration | duration | Duration to negate | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Duration | The negative value of this duration | 
    
  
  Explicit Interface Implementations
  
  IComparable.CompareTo(Object)
  
Implementation of System.IComparable.CompareTo(System.Object) to compare two offsets.
  
  
  Since 1.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    int IComparable.CompareTo(object obj)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Object | obj | The object to compare this value with. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Int32 | The result of comparing this instant with another one; see CompareTo(Duration) for general details.
If objis null, this method returns a value greater than 0. | 
    
  
  
  
  Exceptions
  
    
      
        | Type | Condition | 
    
    
      
        | ArgumentException | objis non-null but does not refer to an instance of Duration. | 
    
  
  
  ISerializable.GetObjectData(SerializationInfo, StreamingContext)
  
Implementation of System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext).
  
  
  Since 1.2.x
  
  
  Availability net45
  
  Declaration
  
    [SecurityCritical]
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | SerializationInfo | info | The System.Runtime.Serialization.SerializationInfo to populate with data. | 
      
        | StreamingContext | context | The destination for this serialization. | 
    
  
  Exceptions
  
    
      
        | Type | Condition | 
    
    
      
        | ArgumentNullException | info is null. | 
    
  
  
  IXmlSerializable.GetSchema()
  
  
  
  Since 1.2.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    XmlSchema IXmlSerializable.GetSchema()
   
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | XmlSchema |  | 
    
  
  
  IXmlSerializable.ReadXml(XmlReader)
  
  
  
  Since 1.2.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    void IXmlSerializable.ReadXml(XmlReader reader)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | XmlReader | reader |  | 
    
  
  Exceptions
  
    
      
        | Type | Condition | 
    
    
      
        | ArgumentNullException | reader is null. | 
    
  
  
  IXmlSerializable.WriteXml(XmlWriter)
  
  
  
  Since 1.2.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
  
    void IXmlSerializable.WriteXml(XmlWriter writer)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | XmlWriter | writer |  | 
    
  
  Exceptions
  
    
      
        | Type | Condition | 
    
    
      
        | ArgumentNullException | writer is null. | 
    
  
  Implements
  
      System.IEquatable<T>
  
  
      System.IComparable<T>
  
  
      System.IComparable
  
  
      System.Xml.Serialization.IXmlSerializable
  
  
      System.IFormattable
  
  
      System.Runtime.Serialization.ISerializable