Comparing two structs using ==
You need to overload the ==
and !=
operators. Add this to your struct
:
public static bool operator ==(CisSettings c1, CisSettings c2)
{
return c1.Equals(c2);
}
public static bool operator !=(CisSettings c1, CisSettings c2)
{
return !c1.Equals(c2);
}
When you override the .Equals()
method, the ==
operator is not automatically overloaded. You need to do that explicitly.
See also Guidelines for Overriding Equals() and Operator == or CA1815: Override equals and operator equals on value types.