DurationHelper DurationHelper DurationHelper Class

Provides basic utility methods for processing Duration values. C# and Microsoft Visual Basic code should use methods of Duration instead.

Syntax

Declaration

public sealed class DurationHelperpublic sealed class DurationHelperPublic NotInheritable Class DurationHelper

Remarks

Duration is a Windows Runtime structure that represents a unit of time for an animation behavior. For example, Duration uses a Duration value.

DurationHelper is one of several Helper classes that are intended to provide utility methods for Windows Runtime structure values. C# and Microsoft Visual Basic code can use members of Duration instead, because utility members are available directly on the structure due to .NET Framework runtime support. C++ code can only access the Timespan data value on Duration. For C++ developers, approximately the same utility features that a Microsoft Visual Basic developer could use directly on Duration are available in a static form on the DurationHelper class.

Properties summary

Returns a generated Duration value that indicates an "Automatic" Duration. C# and Microsoft Visual Basic code should use Automatic instead.

Returns a generated Duration value that indicates a "Forever" Duration. C# and Microsoft Visual Basic code should use Forever instead.

Methods summary

Adds the TimeSpan component of two Duration values. C# and Microsoft Visual Basic code should use the + operator or the Add method instead.

Compares value equality of two Duration structures. C# and Microsoft Visual Basic code should use Compare instead.

Determines whether two Duration values have equivalent values. C# and Microsoft Visual Basic code should use the = operator instead.

Creates a new Duration based on a TimeSpan value. C# and Microsoft Visual Basic code should Duration(TimeSpan) instead.

Returns whether the TimeSpan component of a given Duration holds a non-null value. C# and Microsoft Visual Basic code should use HasTimeSpan instead.

Subtracts the TimeSpan component of one Duration value from another Duration value. C# and Microsoft Visual Basic code should use the - operator or the Subtract method instead.

Properties

  • Automatic
    Automatic
    Automatic
    Automatic

    Returns a generated Duration value that indicates an "Automatic" Duration. C# and Microsoft Visual Basic code should use Automatic instead.

    public static Duration Automatic { get; }public static Duration Automatic { get; }Public Static ReadOnly Property Automatic As Duration

    Property Value

  • Forever
    Forever
    Forever
    Forever

    Returns a generated Duration value that indicates a "Forever" Duration. C# and Microsoft Visual Basic code should use Forever instead.

    public static Duration Forever { get; }public static Duration Forever { get; }Public Static ReadOnly Property Forever As Duration

    Property Value

Methods

  • Add(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)
    Add(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)
    Add(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)
    Add(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)

    Adds the TimeSpan component of two Duration values. C# and Microsoft Visual Basic code should use the + operator or the Add method instead.

    public static Duration Add(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)public static Duration Add(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)Public Static Function Add(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration) As Duration

    Parameters

    Returns

  • Compare(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)
    Compare(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)
    Compare(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)
    Compare(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)

    Compares value equality of two Duration structures. C# and Microsoft Visual Basic code should use Compare instead.

    public static int Compare(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)public static int Compare(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)Public Static Function Compare(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration) As int

    Parameters

    Returns

    • int
      int
      int

      If duration1 is less than duration2, a negative value that represents the difference. If duration1 is equal to duration2, zero. If duration1 is greater than duration2, a positive value that represents the difference.

    Remarks

    Duration instances with a value of Automaticare a special case with the following return values:

    • If duration1 is Automatic and duration2 is not, -1 is returned.
    • If duration1 is Automatic and duration2 is also Automatic, 0 is returned.
    • If duration1 is not Automatic and duration2 is Automatic, 1 is returned.
  • Equals(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)
    Equals(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)
    Equals(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)
    Equals(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)

    Determines whether two Duration values have equivalent values. C# and Microsoft Visual Basic code should use the = operator instead.

    public static bool Equals(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)public static bool Equals(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)Public Static Function Equals(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration) As bool

    Parameters

    Returns

    • bool
      bool
      bool

      true if target and value hold equivalent values; otherwise, false.

  • FromTimeSpan(Windows.Foundation.TimeSpan)
    FromTimeSpan(Windows.Foundation.TimeSpan)
    FromTimeSpan(Windows.Foundation.TimeSpan)
    FromTimeSpan(Windows.Foundation.TimeSpan)

    Creates a new Duration based on a TimeSpan value. C# and Microsoft Visual Basic code should Duration(TimeSpan) instead.

    public static Duration FromTimeSpan(Windows.Foundation.TimeSpan)public static Duration FromTimeSpan(Windows.Foundation.TimeSpan)Public Static Function FromTimeSpan(Windows.Foundation.TimeSpan) As Duration

    Parameters

    Returns

  • GetHasTimeSpan(Windows.UI.Xaml.Duration)
    GetHasTimeSpan(Windows.UI.Xaml.Duration)
    GetHasTimeSpan(Windows.UI.Xaml.Duration)
    GetHasTimeSpan(Windows.UI.Xaml.Duration)

    Returns whether the TimeSpan component of a given Duration holds a non-null value. C# and Microsoft Visual Basic code should use HasTimeSpan instead.

    public static bool GetHasTimeSpan(Windows.UI.Xaml.Duration)public static bool GetHasTimeSpan(Windows.UI.Xaml.Duration)Public Static Function GetHasTimeSpan(Windows.UI.Xaml.Duration) As bool

    Parameters

    Returns

    • bool
      bool
      bool

      true if the TimeSpan component of the provided Duration is not null; otherwise, false.

    Remarks

    If this method returns false, then the Duration is either uninitialized or holds one of the special values of Automatic or Forever.

  • Subtract(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)
    Subtract(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)
    Subtract(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)
    Subtract(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)

    Subtracts the TimeSpan component of one Duration value from another Duration value. C# and Microsoft Visual Basic code should use the - operator or the Subtract method instead.

    public static Duration Subtract(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)public static Duration Subtract(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration)Public Static Function Subtract(Windows.UI.Xaml.Duration,Windows.UI.Xaml.Duration) As Duration

    Parameters

    Returns

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.UI.Xaml.dll