Set 6-item tuple in C#’


With C#, you can easily set a 6-item tuple.

The following is a 6-item tuple −

var myTuple = new Tuple<string, string[], int, int, int, int>("electronics",
new string[] { "shoes", "clothing#", "accessories" },
100,
250,
500,
1000);

above, we have tuple for string, string array and int as shown below −

Tuple<string, string[], int, int, int, int>

Here is the complete code −

Example

 Live Demo

using System;
class Demo {
   static void Main() {
      var myTuple = new Tuple<string, string[], int, int, int, int>("electronics",
      new string[] { "shoes", "clothing#", "accessories" },
      100,
      250,
      500,
      1000);
      // Displaying Item 1
      Console.WriteLine(myTuple.Item1);
      // Displaying Item 5
      Console.WriteLine(myTuple.Item5);
      // Displaying Item 6
      Console.WriteLine(myTuple.Item6);
   }
}

Output

electronics
500
1000

Updated on: 22-Jun-2020

59 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements