I need to use a byte[] as a key in a Dictionary. Since byte[] doesn\'t override the default GetHashCode method, two sepa
When you are retrieving the items from the Dictionary you are using new operator for the byte[]. This will look for a different (new) byte[] instance in the Dictionary which is not present.
Here is a solution that will work:
var dict = new Dictionary();
var b = new byte[] { 1,2,3};
dict[b] = "my string";
var value = dict[b];
Console.WriteLine(value);