Set 6-item tuple in C#’

CsharpProgrammingServer Side Programming

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
raja
Published on 05-Sep-2018 08:52:55
Advertisements