How to create 6-Tuple in C#?
Last Updated :
11 Jul, 2025
In C#, a 6-tuple is a
tuple that contains six elements and it is also known as
sextuple. You can create a 6-tuple using two different ways:
- Using Tuple<T1,T2,T3,T4,T5,T6>(T1, T2, T3, T4, T5, T6) Constructor
- Using the Create method
Using Tuple<T1,T2,T3,T4,T5,T6>(T1, T2, T3, T4, T5, T6) Constructor
You can create 6-tuple using Tuple<T1, T2, T3, T4, T5, T6>(T1, T2, T3, T4, T5, T6) constructor. It initializes a new instance of the Tuple<T1, T2, T3, T4, T5, T6> 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, T4 item4, T5 item5, T6 item6);
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.
- item4: It is the value of the fourth tuple component.
- item5: It is the value of the fifth tuple component.
- item6: It is the value of the sixth tuple component.
Example:
CSharp
// C# program to create 6-tuple
// using the tuple constructor
using System;
public class GFG {
// Main method
static public void Main()
{
// Creating tuple with six elements
// Using Tuple<T1, T2, T3, T4, T5,
// T6>(T1, T2, T3, T4, T5, T6) constructor
Tuple<int, int, int, int, int, int> My_Tuple = new Tuple<int, int,
int, int, int, int>(22, 33, 44, 545, 55, 66);
Console.WriteLine("Element 1: " + My_Tuple.Item1);
Console.WriteLine("Element 2: " + My_Tuple.Item2);
Console.WriteLine("Element 3: " + My_Tuple.Item3);
Console.WriteLine("Element 4: " + My_Tuple.Item4);
Console.WriteLine("Element 5: " + My_Tuple.Item5);
Console.WriteLine("Element 6: " + My_Tuple.Item6);
}
}
Output:
Element 1: 22
Element 2: 33
Element 3: 44
Element 4: 545
Element 5: 55
Element 6: 66
Using Create Method
You can also create 6-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,T4,T5,T6> Create<T1, T2, T3, T4, T5, T6> (T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6);
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.
- T4: It is the type of the fourth tuple component.
- T5: It is the type of the fifth tuple component.
- T6: It is the type of the sixth 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.
- item4: It is the value of the fourth tuple component.
- item5: It is the value of the fifth tuple component.
- item6: It is the value of the sixth tuple component.
Return Type: This method returns 6-tuple whose value is
item1, item2,
item3,
item4,
item5 and
item6.
Example:
CSharp
// C# program to create 6-tuple
// using create method
using System;
public class GFG {
// Main method
static public void Main()
{
// Creating tuple with six elements
// Using Create method
var My_Tuple = Tuple.Create("C", "C++", "Ruby",
"Java", "Perl", "PHP");
Console.WriteLine("Element 1: " + My_Tuple.Item1);
Console.WriteLine("Element 2: " + My_Tuple.Item2);
Console.WriteLine("Element 3: " + My_Tuple.Item3);
Console.WriteLine("Element 4: " + My_Tuple.Item4);
Console.WriteLine("Element 5: " + My_Tuple.Item5);
Console.WriteLine("Element 6: " + My_Tuple.Item6);
}
}
Output:
Element 1: C
Element 2: C++
Element 3: Ruby
Element 4: Java
Element 5: Perl
Element 6: PHP
Reference:
Similar Reads
How to create 6-ValueTuple in C#? In C#, a 6-ValueTuple or sextuple is a value type tuple which contains six elements. You can create a 6-ValueTuple using two different ways: Using ValueTuple <T1, T2, T3, T4, T5, T6>(T1, T2, T3, T4, T5, T6) Constructor Using Create <T1, T2, T3, T4, T5, T6>(T1, T2, T3, T4, T5, T6) Method
4 min read
How to create 8-ValueTuple in C#? In C#, an 8-ValueTuple is a value type tuple which contains eight elements and it is also known as octuple. You can create an 8-ValueTuple using two different ways: Using ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest<(T1, T2, T3, T4, T5, T6, T7, TRest) Constructor Using Create<T1, T2, T3, T4
5 min read
How to create 7-ValueTuple in C#? In C#, a 7-ValueTuple is a value type tuple which contains seven elements and it is also known as septuple. You can create a 7-ValueTuple using two different ways: Using ValueTuple <T1, T2, T3, T4, T5, T6, T7>(T1, T2, T3, T4, T5, T6, T7) Constructor Using Create <T1, T2, T3, T4, T5, T6, T7
4 min read
How to create 4-ValueTuple in C#? In C#, a quadruple or 4 value tuple is a value type tuple which holds four elements in it. You can create a quadruple value tuple using two different ways: Using ValueTuple <T1, T2, T3, T4>(T1, T2, T3, T4) Constructor Using Create <T1, T2, T3, T4>(T1, T2, T3, T4) method Using ValueTuple
3 min read
How to create 5-ValueTuple in C#? In C#, a 5-ValueTuple or quintuple is a value type tuple which contains five elements. You can create a 5-ValueTuple using two different ways: Using ValueTuple <T1, T2, T3, T4, T5>(T1, T2, T3, T4, T5) Constructor Using Create <T1, T2, T3, T4, T5>(T1, T2, T3, T4, T5) Method Using ValueTup
4 min read
How to create 3-ValueTuple in C#? In C#, a triple or 3 value tuple is a value type tuple which holds three elements in it. You can create a triple value tuple using two different ways: Using ValueTuple <T1, T2, T3>(T1, T2, T3) Constructor Using Create <T1, T2, T3>(T1, T2, T3) Method Using ValueTuple <T1, T2, T3>(T1
3 min read