As already answered, each array is indeed different object. By default, arrays are compared using object reference, without taking into account the actual content of the array. You can work around this by implementing your own array comparer, like this:
class ArrayComparer<T> : IEqualityComparer<T[]> {
public bool Equals(T[] x, T[] y) {
return ((IStructuralEquatable) x).Equals((IStructuralEquatable) y, EqualityComparer<T>.Default);
}
public int GetHashCode(T[] obj) {
return ((IStructuralEquatable) obj).GetHashCode(EqualityComparer<T>.Default);
}
}
It works using built-in Array functionality (Array implements IStructuralEquatable) to provide equality and hashcode operations which respect array elements. Then you do:
Dictionary<string[], object[]> list = new Dictionary<string[], object[]>(new ArrayComparer<string>());
And it will work even if you pass different instances or arrays. Whether you should have a dictionary where keys are arrays is a different story....