DurationHelper.Compare(Duration, Duration) DurationHelper.Compare(Duration, Duration) DurationHelper.Compare(Duration, Duration) DurationHelper.Compare(Duration, Duration) Method

Definition

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

public : static int Compare(Duration duration1, Duration duration2)
static int32_t Compare(Duration duration1, Duration duration2) const;
public static int Compare(Duration duration1, Duration duration2)
Public Shared Function Compare(duration1 As Duration, duration2 As Duration) As int

Parameters

duration1
Duration Duration

The first Duration to compare.

duration2
Duration Duration

The second Duration to compare.

Returns

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.