C# TimeSpan Inequality

Description

TimeSpan Inequality indicates whether two TimeSpan instances are not equal.

Syntax

TimeSpan.Inequality has the following syntax.


public static bool operator !=(
  TimeSpan t1,
  TimeSpan t2
)

Parameters

TimeSpan.Inequality has the following parameters.

  • t1 - The first time interval to compare.
  • t2 - The second time interval to compare.

Returns

TimeSpan.Inequality method returns true if the values of t1 and t2 are not equal; otherwise, false.

Example

The following example compares several TimeSpan objects to a reference TimeSpan using the Inequality operator.


using System;/*  w  ww . j  a va 2s  .c o  m*/

class MainClass
{
    static void Main( )
    {
        TimeSpan Left = new TimeSpan( 2, 0, 0 );

        Console.WriteLine( Left != new TimeSpan( 0, 120, 0 ));
    } 
} 

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version