টাপল তুলনা C# 7.3 এর পরে এসেছে।
C#-এ সমতা অপারেটর (==) ব্যবহার করে সহজে দুটি টাপল তুলনা করা যায়।
মান লইয়ে আমাদের দুটি টাপল আছে −
var one = (x: 1, y: 2); var two = (p: 1, 2: 3, r: 3, s:4);
তুলনা করতে শুধু == অপারেটর ব্যবহার করুন −
if (one == two) Console.WriteLine("Both the tuples are same (values are same).");কোডটি দেখি −
উদাহরণ
var one = (x: 1, y: 2); var two = (p: 1, 2: 3, r: 3, s:4); if (one == two) Console.WriteLine("Both the tuples are same (values are same)."); lse Console.WriteLine("Both the tuples values are not same.");