VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/how-to-create-3-tuple-or-triple-tuple-in-c-sharp/

⇱ How to create 3-Tuple or Triple Tuple in C#? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to create 3-Tuple or Triple Tuple in C#?

Last Updated : 11 Jul, 2025
In C#, a 3-tuple is a tuple that contains three elements and it is also known as triple. You can create a 3-tuple using two different ways:

Using Tuple<T1,T2,T3>(T1, T2, T3) Constructor

You can create 3-tuple using Tuple<T1, T2,T3>(T1, T2, T3) constructor. It initializes a new instance of the Tuple<T1, T2, T3> class. But when you create a tuple using this constructor then you have to specify the type of the element stored in the tuple. Syntax:
public Tuple (T1 item1, T2 item2, T3 item3);
Parameters:
  • item1: It is the value of the first tuple component.
  • item2: It is the value of the second tuple component.
  • item3: It is the value of the third tuple component.
Example:
Output:
Element 1: GeeksforGeeks
Element 2: 10
Element 3: C#

Using Create Method

You can also create 3-tuple with the help of Create method. When you use this method then there is no need to specify the type of the elements stored in the tuple. Syntax:
public static Tuple<T1,T2,T3> Create<T1, T2, T3> (T1 item1, T2 item2, T3 item3);
Type Parameters:
  • T1: It is the type of the first tuple component.
  • T2: It is the type of the second tuple component.
  • T3: It is the type of the third tuple component.
Parameters:
  • item1: It is the value of the first tuple component.
  • item2: It is the value of the second tuple component.
  • item3: It is the value of the third tuple component.
Return Type: This method returns 3-tuple whose value is item1, item2, and item3. Example:
Comment
Article Tags:
Article Tags:

Explore