C# Tuple Equals

Description

Tuple Equals returns a value that indicates whether the current Tuple object is equal to a specified object.

Syntax

Tuple<T1>.Equals has the following syntax.


public override bool Equals(
  Object obj
)

Parameters

Tuple<T1>.Equals has the following parameters.

  • obj - The object to compare with this instance.

Returns

Tuple<T1>.Equals method returns true if the current instance is equal to the specified object; otherwise, false.

Example

The following example calls the Tuple<T1>.Equals(Object) method to compare a Tuple<T1> object.


/* w  w w. j a v  a 2s .co m*/

using System;

public class Example
{
   public static void Main()
   {
      var doubleTuple1 = Tuple.Create(12.345);
      var doubleTuple2 = Tuple.Create(16.897);

      Console.WriteLine(doubleTuple1.Equals(doubleTuple2));
   } 
}

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