rsmith1302
New member
- Joined
- Jul 25, 2023
- Messages
- 4
- Programming Experience
- 10+
If I use an array of strings as a dictionary key, I can't retrieve by key later on. In the following code, why does the second ContainsKey return false?
Dim dict As New Dictionary(Of String(), Integer)
Dim key1 As String() = {"c", "d"}
Dim key2 As String() = {"c", "d"}
dict.Add(key1, 0)
Debug.Print(dict.ContainsKey(key1)) ' returns True
Debug.Print(dict.ContainsKey(key2)) ' returns False
And how do I put my code sample in one of those nicely formatted blocks in this post?
Dim dict As New Dictionary(Of String(), Integer)
Dim key1 As String() = {"c", "d"}
Dim key2 As String() = {"c", "d"}
dict.Add(key1, 0)
Debug.Print(dict.ContainsKey(key1)) ' returns True
Debug.Print(dict.ContainsKey(key2)) ' returns False
And how do I put my code sample in one of those nicely formatted blocks in this post?
Last edited: