tuple c# out put code example
Example 1: c# initialize tuple with default values
(double, int) t1 = (4.5, 3);
Console.WriteLine($"Tuple with elements {t1.Item1} and {t1.Item2}.");
(double Sum, int Count) t2 = (4.5, 3);
Console.WriteLine($"Sum of {t2.Count} elements is {t2.Sum}.");
Example 2: tuple parameter name
(string name, int id) user = ("jack", 1);
Console.WriteLine($"{user.name}, {user.id}");
List<(string name, int id)> users = new List<(string, int)>();
users.Add(("jack", 1));
users.Add(("john", 2));
users.ForEach((x) =>
Console.WriteLine($"{x.name}, {x.id}")):