I need to use a byte[] as a key in a Dictionary. Since byte[] doesn\'t override the default GetHashCode method, two sepa
byte[]
Dictionary
GetHashCode
using System; using System.Collections; using System.Collections.Generic; [Serializable] class StructuralEqualityComparer : IEqualityComparer, IEqualityComparer { public new bool Equals(object x, object y) { var s = x as IStructuralEquatable; return s == null ? object.Equals(x, y) : s.Equals(y, this); } public int GetHashCode(object obj) { var s = obj as IStructuralEquatable; return s == null ? EqualityComparer.Default.GetHashCode(obj) : s.GetHashCode(this); } }