c# name your tuples code example
Example: tuple parameter name
// Tuples cannot be assigned parameter names.
//Instead you could do something like this:
(string name, int id) user = ("jack", 1);
Console.WriteLine($"{user.name}, {user.id}");
// Output:
// jack, 1
// When working with lists:
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}")):
// Output:
// jack, 1
// john, 2