सबसे पहले, Tuple में दो Items Set करें।
Tupletuple = new Tuple (20, "Tom");
अब Tuple में First Item Check करें, जो Integer है।
if (tuple.Item1 == 20) { Console.WriteLine(tuple.Item1); }अब Tuple में Second Item Check करें, जो String है:
if (tuple.Item2 == "Tom") { Console.WriteLine(tuple.Item2); }निम्न Example String और Int Items के साथ Tuple Create करने का है।
Example
using System; using System.Threading; namespace Demo { class Program { static void Main(string[] args) { Tuple tuple = new Tuple(20, "Tom"); if (tuple.Item1 == 20) { Console.WriteLine(tuple.Item1); } if (tuple.Item2 == "Tom") { Console.WriteLine(tuple.Item2); } } } } Output
20 Tom