access tuple element c# code example
Example 1: c# tuple access
var numbers = Tuple.Create(1, 2, Tuple.Create(3, 4, 5, 6, 7, 8), 9, 10, 11, 12, 13 );
numbers.Item1;
numbers.Item2;
numbers.Item3;
numbers.Item3.Item1;
numbers.Item4;
numbers.Rest.Item1;
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}")):