- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to compare two tuples in C#?
Tuple comparison came after C# 7.3.
Easily compare two tuples using the equality operator in C#.
Let’s say we have two tuples −
var one = (x: 1, y: 2); var two = (p: 1, 2: 3, r: 3, s:4);
To compare them, just use the == operator −
if (one == two) Console.WriteLine("Both the tuples are same (values are same).");
Let use see the code −
Example
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.");
- Related Articles
- How do we compare two tuples in Python?
- Compare tuples in Python
- How to compare two arrays in C#?
- How to compare two Dates in C#?
- How to compare two dictionaries in C#?
- How to compare two lists for equality in C#?
- Program to compare two fractions in C
- How to compare two arrays in Java?
- How to compare two objects in JavaScript?
- How to compare two dates in Java?
- How to compare two numbers in JavaScript?
- How to Compare two String in Java?
- How to compare two lists in Python?
- How to compare two branches in Git?
- How to compare two tensors in PyTorch?

Advertisements