I want to compare a large Struct in C# via Equals
, which in turn is implemented through IEquatable<T>
Interface.
My Problem is that it performs very poorly, as my struct is rather large.
Imagine a simplified version of the struct like the follwoing:
public struct Data
{
public byte b0;
public byte b1;
public byte b2;
public byte b3;
public byte b4;
public byte b5;
public byte b6;
public byte b7;
}
我现在写一个简单的Equals:
public bool Equals(Data other)
{
return b0 == other.b0 &&
b1 == other.b1 &&
...
}
有什么方法可以使equals方法更高效吗?
Update个