public static bool EqualityOperator(object lhs, object rhs)
{
if (lhs == rhs) return true;
// Some types do overload Equals to compare
// against null values
if (null == lhs) return rhs.Equals(lhs);
if (null == rhs) return lhs.Equals(rhs);
TypeCode lhsTypeCode = Type.GetTypeCode(lhs.GetType());
TypeCode rhsTypeCode = Type.GetTypeCode(rhs.GetType());
if (IsNumeric(lhsTypeCode) && IsNumeric(rhsTypeCode))
{
return EqualityOperator(lhs, lhsTypeCode, rhs, rhsTypeCode);
}
Array lhsa = lhs as Array;
if (null != lhsa)
{
Array rhsa = rhs as Array;
if (null != rhsa)
{
return ArrayEqualityImpl(lhsa, rhsa);
}
}
return lhs.Equals(rhs) || rhs.Equals(lhs);
}