टपल घोषित करने का प्रारूप निम्नलिखित है, जिसमें int और string आइटम्स के साथ एक टपल है:
Tuple<int, string> tuple = new Tuple<int, string>(20, "Tom");
अब टपल में पहले आइटम की जांच करें, जो एक इंटीजर है:
if (tuple.Item1 == 99) { Console.WriteLine(tuple.Item1); }अब टपल में दूसरे आइटम की जांच करें, जो एक स्ट्रिंग है:
if (tuple.Item2 == "Tim") { Console.WriteLine(tuple.Item2); }स्ट्रिंग और int आइटम्स के साथ टपल बनाने का उदाहरण:
using System; using System.Threading; namespace Demo { class Program { static void Main(string[] args) { Tuple<int, string> tuple = new Tuple<int, string>(50, "Tom"); if (tuple.Item1 == 99) { Console.WriteLine(tuple.Item1); } if (tuple.Item2 == "Tim") { Console.WriteLine(tuple.Item2); } } } }