Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Duration Structure
Collapse the table of content
Expand the table of content

Duration Structure

Represents the duration of time that a Timeline is active.

Namespace:  System.Windows
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

[TypeConverterAttribute(typeof(DurationConverter))]
public struct Duration
<object property="[days.]hours:minutes:seconds[.fractionalSeconds]"/>- or -<object property="[days.]hours:minutes"/>- or -<object property="Automatic"/>- or -<object property="Forever"/>

XAML Values

days

System.Int32

A value greater than or equal to 0 that describes the number of days spanned by this duration.

hours

System.Int32

A value between 0 and 23 that represents the number of hours spanned by this duration.

minutes

System.Int32

A value between 0 and 59 that represents the number of minutes spanned by this duration.

seconds

System.Int32

A value between 0 and 59 that represents the number of seconds spanned by this duration

fractionalSeconds

System.Int32

A value consisting of 1 to 7 digits that represents fractional seconds.

The Duration type exposes the following members.

  NameDescription
Public methodDurationInitializes a new instance of the Duration structure with the supplied TimeSpan value.
Top

  NameDescription
Public propertyStatic memberAutomaticGets a Duration value that is automatically determined.
Public propertyStatic memberForeverGets a Duration value that represents an infinite interval.
Public propertyHasTimeSpanGets a value that indicates if this Duration represents a TimeSpan value.
Public propertyTimeSpanGets the TimeSpan value that this Duration represents.
Top

  NameDescription
Public methodAddAdds the value of the specified instance of Duration to the value of the current instance.
Public methodStatic memberCompareCompares one Duration value to another.
Public methodEquals(Duration)Determines whether a specified Duration is equal to this instance of Duration.
Public methodEquals(Object)Determines whether a specified object is equal to an instance of Duration. (Overrides ValueType.Equals(Object).)
Public methodStatic memberEquals(Duration, Duration)Determines whether two instances of Duration are equal.
Public methodGetHashCodeGets a hash code for this instance. (Overrides ValueType.GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodStatic memberPlusReturns the specified instance of Duration.
Public methodSubtractSubtracts the value of the specified instance of Duration from this instance.
Public methodToStringConverts an instance of Duration to a String representation. (Overrides ValueType.ToString().)
Top

  NameDescription
Public operatorStatic memberAdditionAdds two instances of Duration together.
Public operatorStatic memberEqualityDetermines whether two instances of Duration are equal.
Public operatorStatic memberGreaterThanDetermines if one instance of Duration is greater than another.
Public operatorStatic memberGreaterThanOrEqualDetermines whether an instance of Duration is greater than or equal to another instance.
Public operatorStatic memberImplicit(TimeSpan to Duration)Implicitly creates a Duration from a given TimeSpan.
Public operatorStatic memberInequalityDetermines if two instances of Duration are not equal.
Public operatorStatic memberLessThanDetermines if the value of one instance of Duration is less than the value of another instance.
Public operatorStatic memberLessThanOrEqualDetermines if the value of one instance of Duration is less than or equal to the value of another instance.
Public operatorStatic memberSubtractionSubtracts the value of one instance of Duration from another.
Public operatorStatic memberUnaryPlusReturns the specified instance of Duration.
Top

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2015 Microsoft