You can achieve that using custom IEqualityComparer<byte[]>
(or even better, generic one: IEqualityComparer<T[]>
) implementation:
class ArrayComparer<T> : IEqualityComparer<T[]>
{
public bool Equals(T[] x, T[] y)
{
return x.SequenceEqual(y);
}
public int GetHashCode(T[] obj)
{
return obj.Aggregate(string.Empty, (s, i) => s + i.GetHashCode(), s => s.GetHashCode());
}
}
I'm pretty sure GetHashCode
could be implemented much better, but it's just an example!
Usage:
var grouped = source.GroupBy(i => i.Item3, new ArrayComparer<byte>())
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…