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: c# tuple
Tuple<int, string, string> person =
new Tuple <int, string, string>(1, "Steve", "Jobs");
var person = Tuple.Create(1, "Steve", "Jobs");
person.Item1;
person.Item2;
person.Item3;
var numbers = Tuple.Create("One", 2, 3, "Four", 5, "Six", 7, 8);
numbers.Item1;
numbers.Item2;
numbers.Item3;
numbers.Item4;
numbers.Item5;
numbers.Item6;
numbers.Item7;
numbers.Rest;
numbers.Rest.Item1;
Example 3: 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 4: c# tuple
var tupleList = new List<Tuple<int, string, string, string>>();
tupleList.Add(Tuple.Create(1, "Sefat Anam", "Dhaka Bangladesh", "0.1245345"));