Duration.op_Inequality

Duration Inequality operator

Returns a value indicating whether this instance is not equal to a specified object.

public static bool operator !=(Duration a, Duration b)
ParameterTypeDescription
aDurationThe first duration.
bDurationThe second duration.

Return Value

a value indicating whether this instance is not equal to a specified object

Examples

Shows how to check duration equality.

var project = new Project();

var duration1 = project.GetDuration(1, TimeUnitType.Day);
var duration2 = project.GetDuration(1, TimeUnitType.Day);
var duration3 = project.GetDuration(1, TimeUnitType.Hour);

// the equality of duration is checked against to underlying timespan
Console.WriteLine("Duration 1: " + duration1.TimeSpan);
Console.WriteLine("Duration 2: " + duration2.TimeSpan);
Console.WriteLine("Duration 3: " + duration3.TimeSpan);
Console.WriteLine("Are durations 1 and 2 equal: " + duration1.Equals(duration2));
Console.WriteLine("Are durations 1 and 3 equal: " + duration1.Equals(duration3));

See Also