Sdílet prostřednictvím


DurationHelper.Compare(Duration, Duration) Method

Definition

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

 static int Compare(Duration const& duration1, Duration const& duration2);
public static int Compare(Duration duration1, Duration duration2);
function compare(duration1, duration2)
Public Shared Function Compare (duration1 As Duration, duration2 As Duration) As Integer

Parameters

duration1
Duration

The first Duration to compare.

duration2
Duration

The second Duration to compare.

Returns

Int32

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

Durationinstances 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.

Applies to