KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I wish to have the dictionary which uses an array of integers as keys, and if the integer array has the same value (even different object instance), they will be treated as the same key. How should I do it? The following code does not work as b is different object instances. int[] a = new int[] { 1, 2, 3 }; int[] b = new int[] { 1, 2, 3 }; Dictionary<int[], string> dic = new Dictionary<int[], string>(); dic.Add(a, "haha"); string output = dic[b];
Tags (comma-separated)
Save Edits
Cancel