Last Updated : 11 Jul, 2025
Tuple<T1, T2, T3> class creates a 3-tuple or triple. It represents a tuple that contains three elements. we can instantiate a Tuple<T1, T2, T3> object by calling either the Tuple<T1, T2, T3>(T1, T2, T3) constructor or by the static Tuple.Create method. We can retrieve the value of the tuple’s elements using the read-only Item1, Item2, and Item3 instance properties. There are some important points mentioned below:
Tuple<T1, T2, T3>(T1, T2, T3)Property
Example:
C#
using System;
class Geeks
{
static public void Main()
{
// Creating 3-Tuple using constructor
Tuple<int, int, int> t = new Tuple<int, int, int>(79, 34, 67);
// Accessing the values
Console.WriteLine("Value of the 1st Component: " + t.Item1);
Console.WriteLine("Value of the 2nd Component: " + t.Item2);
Console.WriteLine("Value of the 3rd Component: " + t.Item3);
}
}
Value of the 1st Component: 79 Value of the 2nd Component: 34 Value of the 3rd Component: 67Methods
There are some important methods which are used in tuples are given below:
Method
Description
Returns a value that indicates whether the current Tuple object is equal to a specified object.
Returns the hash code for the current Tuple<T1, T2, T3> object.
Gets the Type of the current instance.
MemberwiseClone()
Creates a shallow copy of the current Object.
ToString()
Returns a string that represents the value of this Tuple<T1, T2, T3> instance.
Example:
C#
using System;
class Geeks
{
static public void Main()
{
// Creating 3-Tuple using constructor
Tuple<int, int, int> mytuple1 = new Tuple<int, int, int>(20, 40, 90);
Tuple<int, int, int> mytuple2 = new Tuple<int, int, int>(20, 49, 87);
// Using Equals method
if (mytuple1.Equals(mytuple2))
Console.WriteLine("Tuple Matched..");
else
Console.WriteLine("Tuple not matched..");
}
}
Tuple not matched..
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4