using System;
using System.Collections.Generic;
namespace ConsoleApp1
{
internal class Program
{
private static void Main(string[] args)
{
var listEmployee = new List<Tuple<int, int, string>>
{
Tuple.Create(1, 1, "USA"),
Tuple.Create(1, 1, "VN"),
Tuple.Create(1, 2, "USA"),
Tuple.Create(1, 2, "VN"),
Tuple.Create(1, 3, "USA"),
Tuple.Create(1, 3, "VN")
};
foreach (Tuple<int, int, string> t in listEmployee)
{
Console.WriteLine("{0},{1},{2}", t.Item1, t.Item2, t.Item3);
}
// Create three-item tuple.
Tuple<int, string, bool> tuple = new Tuple<int, string, bool>(1, "cat", true);
// Access tuple properties.
if (tuple.Item1 == 1)
{
Console.WriteLine(tuple.Item1);
}
if (tuple.Item2 == "dog")
{
Console.WriteLine(tuple.Item2);
}
if (tuple.Item3)
{
Console.WriteLine(tuple.Item3);
}
Console.Read();
}
}
}