To compare two instances of ValueTuple you can use CompareTo method which is provided by ValueTuple structure. ValueTuple.CompareTo(ValueTuple) Method is used to compare the current instance of ValueTuple with another ValueTuple instance. It always returns zero if they are equal to each other.
public int CompareTo (ValueTuple other);
Here, other is the object to compare with the current instance.
Returns: The method always returns 0 of type System.Int32.
Exception: This method will throw an ArgumentException if the other is not ValueTuple instance.
Result 1: 1 Result 2: 0 Result 3: -1
Welcome to GeeksforGeeks
- ValueTuple in C#
- How to create 4-ValueTuple in C#?
- How to get third Element of the ValueTuple in C#?
- How to create 6-ValueTuple in C#?
- C# | ValueTuple <T1> Struct
- How to create 3-ValueTuple in C#?
- How to get fifth Element of the ValueTuple in C#?
- How to get Second Element of the ValueTuple in C#?
- How to create 2-ValueTuple in C#?
- How to create 8-ValueTuple in C#?
- C# | ValueTuple <T1,T2,T3> Struct
- ValueTuple Struct in C#
- How to create 1-ValueTuple in C#?
- C# | ValueTuple <T1,T2,T3,T4,T5,T6,T7> Struct
- How to get First Element of the ValueTuple in C#?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.