C# Tuple<T1,T2> Class Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The Tuple<T1, T2> is used to create a 2-tuple or pair. It represents a tuple which contains the two elements in it. We can instantiate a Tuple<T1, T2> object by calling either the Tuple<T1, T2>(T1, T2) constructor or the static Tuple.Create method. We can retrieve the value of the tuple’s elements by using the read-only Item1 and Item2 instance properties. There are some important points which are mentioned below:It implements the IStructuralComparable, IStructuralEquatable, and IComparable interface.It is defined under the System namespace.It represents multiple data into a single data set.It allows us to create, manipulate, and access data sets.It returns multiple values from a method without using out parameter.It allows passing multiple values to a method with the help of single parameters.It can also store duplicate elements.Constructor// Initializes a new instance of the Tuple<T1, T2> class.Tuple<T1, T2>(T1, T2) PropertiesItem1 : Gets the value of the Tuple<T1, T2> object’s first component.Item2 : Gets the value of the current Tuple<T1, T2> object’s second component.Example 1: Creating a tuple to create new tuple. C# // Using constructor and property // of Tuple<T1,T2> Class using System; class Geeks { static public void Main() { // Creating 2-Tuple // Using Tuple<T1, T2>(T1, T2) constructor Tuple<int, int> mytuple = new Tuple<int, int>(79, 80); // Accessing the values Console.WriteLine("Value of the First Component: " + mytuple.Item1); Console.WriteLine("Value of the Second Component: " + mytuple.Item2); } } OutputValue of the First Component: 79 Value of the Second Component: 80 Tuple Methods Method DescriptionEquals(Object)Returns a value that indicates whether the current Tuple<T1, T2> object is equal to a specified object.GetHashCode()Returns the hash code for the current Tuple<T1, T2> object.GetType()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> instance.Example 2: Demonstration of Equals() Method. C# // Using the tuple Equals() method using System; public class Geeks { static public void Main() { // Creating 2-Tuple // Using Tuple<T1, T2>(T1, T2) constructor Tuple<int, int> mytuple1 = new Tuple<int, int>(20, 40); Tuple<int, int> mytuple2 = new Tuple<int, int>(20, 49); // Using Equals method if (mytuple1.Equals(mytuple2)) Console.WriteLine("Tuple Matched.."); else Console.WriteLine("Tuple not matched.."); } } OutputTuple not matched.. Comment More info A ankita_saini Follow Improve Article Tags : C# CSharp-Tuple Explore IntroductionC# Tutorial 4 min read Introduction to .NET Framework 6 min read C# .NET Framework (Basic Architecture and Component Stack) 6 min read C# Hello World 2 min read Common Language Runtime (CLR) in C# 4 min read FundamentalsC# Identifiers 2 min read Data Types in C# 6 min read C# Variables 4 min read C# Literals 5 min read Operators in C# 7 min read C# Keywords 5 min read Control StatementsC# Decision Making (if, if-else, if-else-if ladder, nested if, switch, nested switch) 5 min read C# Switch Statement 4 min read Loops in C# 4 min read C# Jump Statements (Break, Continue, Goto, Return and Throw) 4 min read OOP ConceptsClass and Objects in C# 4 min read Constructors in C# 5 min read C# Inheritance 3 min read Encapsulation in C# 2 min read C# Abstraction 4 min read MethodsMethods in C# 4 min read Method Overloading in C# 4 min read C# | Method Parameters 7 min read Method Overriding in C# 7 min read Anonymous Method in C# 3 min read ArraysArrays in C# 6 min read Jagged Arrays in C# 4 min read Array Class in C# 5 min read How to Sort an Array in C# | Array.Sort() Method Set - 1 8 min read How to find the rank of an array in C# 2 min read ArrayListArrayList in C# 6 min read C# ArrayList Class 7 min read C# | Array vs ArrayList 2 min read StringStrings in C# 6 min read C# Verbatim String Literal - @ 5 min read C# String Class 9 min read C# StringBuilder 4 min read C# String vs StringBuilder 3 min read TupleC# Tuple 7 min read C# Tuple Class 3 min read C# ValueTuple 7 min read C# ValueTuple Struct 4 min read IndexersC# Indexers 4 min read C# Multidimensional Indexers 5 min read C# - Overloading of Indexers 3 min read Like