public static int CompareObject(ILockable x, ILockable y) { var hashDiff = x.Hash.CompareTo(y.Hash); if (hashDiff != 0) { return(hashDiff); } var xType = x.GetType(); var yType = y.GetType(); return(String.Compare(xType.AssemblyQualifiedName, yType.AssemblyQualifiedName, StringComparison.InvariantCulture)); }