Open In App

How to create 7-Tuple or Septuple in C#?

Last Updated : 29 Nov, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report

In C#, a 7-tuple is a tuple that contains seven elements and it is also known as Septuple. You can create a 7-tuple using two different ways:

Using Tuple<T1,T2,T3,T4,T5,T6,T7>(T1, T2, T3, T4, T5, T6, T7) Constructor

You can create 7-tuple using Tuple<T1, T2, T3, T4, T5, T6, T7>(T1, T2, T3, T4, T5, T6, T7) constructor. It initializes a new instance of the Tuple<T1, T2, T3, T4, T5, T6, T7> 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, T7 item7);

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.
  • item7: It is the value of the seventh tuple component.

Example: