How to use array inside tuple in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main()
    {
        var tuple = new Tuple<string[], int>(new string[] { "c#", "java", "php" }, 1);
        
        foreach (string s in tuple.Item1) {
            Console.WriteLine(s);
        }
        Console.WriteLine(tuple.Item2);
    }
}


 
 
/*
run:

c#
java
php
1
 
*/


 



answered Sep 13, 2020 by avibootz
edited Sep 13, 2020 by avibootz
...