Tuples as key in Dictionary

azhahes

New member
Joined
May 28, 2022
Messages
2
Programming Experience
3-5
Is Dictionary<(int , int ), int> and Dictionary<Tuple<int , int>, int> are same?
 
Right now, the above feels like a question that would be part of set of screening questions for an interview to make sure that you know C#.

If it's not part of an interview, what have you tried? What does your compiler tell you?
 
No, there was a scenario to use two values as keys, so tried Tuple. I thought of trying different syntax of tuple so tried like this Dictionary<(int, int ), int> and it worked. Both methods give the same result. So I just want to know how it differs and When to go for tuple and when to go for (int i, int j).
 
They are not exactly the same thing.

 

Latest posts

Back
Top Bottom