xxxxxxxxxx
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
List<(string, int)> listOfTuples = new List<(string, int)>();
// Adding tuples to the list
listOfTuples.Add(("John", 25));
listOfTuples.Add(("Alice", 30));
listOfTuples.Add(("Bob", 35));
// Accessing the elements of the list
foreach (var tuple in listOfTuples)
{
Console.WriteLine($"Name: {tuple.Item1}, Age: {tuple.Item2}");
}
}
}
xxxxxxxxxx
var tupleList = new List<(int, string)>
{
(1, "cow"),
(5, "chickens"),
(1, "airplane")
};