C# 什么;“哥特查斯”;我应该知道何时使用Resharper生成IEquatable接口吗?

C# 什么;“哥特查斯”;我应该知道何时使用Resharper生成IEquatable接口吗?,c#,resharper,iequatable,C#,Resharper,Iequatable,我使用Resharper生成了以下代码。我想知道它是好是坏,还是有问题需要解决/注意 我想知道m_customTRP的比较。m_customTRP是一个IList,TimerPower还实现了IEquatable。下面这一行也是 Equals(m_customTRP, other.m_customTRP) …使用TimerPower类的Equals()方法比较每个TimerPower 这看起来一点也不坏,除了匈牙利符号。这通常是您想要的。仅当R#被配置为使用匈牙利符号时才使用匈牙利符号。什么是

我使用Resharper生成了以下代码。我想知道它是好是坏,还是有问题需要解决/注意

我想知道m_customTRP的比较。m_customTRP是一个IList,TimerPower还实现了IEquatable。下面这一行也是

Equals(m_customTRP, other.m_customTRP)
…使用TimerPower类的Equals()方法比较每个TimerPower


这看起来一点也不坏,除了匈牙利符号。这通常是您想要的。仅当R#被配置为使用匈牙利符号时才使用匈牙利符号。什么是
m_customTRP
对象?私有IList m_customTRP;其中“TimeRfPower”是扩展基类“Entity”的另一个类。TimerPower还实现了IEquatable
    //*********************************************************************
    // IEquatable Interface - implemented with Resharper
    //*********************************************************************
    protected bool Equals(Waveform other)
    {
        return base.Equals(other) && m_sweepSpan.Equals(other.m_sweepSpan)
            && m_sweepRate.Equals(other.m_sweepRate)
            && m_bandwidth.Equals(other.m_bandwidth)
            && m_centerFrequency.Equals(other.m_centerFrequency)
            && m_waveformType == other.m_waveformType
            && m_dutyCycle.Equals(other.m_dutyCycle)
            && m_pulsePeriod.Equals(other.m_pulsePeriod)
            && m_modulationFrequency.Equals(other.m_modulationFrequency)
            && m_relativePowerIncrement.Equals(other.m_relativePowerIncrement)
            && m_relativeTimeIncrement.Equals(other.m_relativeTimeIncrement)
            && m_endRelativePower.Equals(other.m_endRelativePower)
            && m_timeRFOn.Equals(other.m_timeRFOn)
            && m_timeRFOff.Equals(other.m_timeRFOff)
            && m_powerReferenceType == other.m_powerReferenceType
            && Equals(m_customTRP, other.m_customTRP);
    }

    //*********************************************************************
    // IEquatable Interface - implemented with Resharper
    //*********************************************************************
    public override bool Equals(object obj)
    {
        if (ReferenceEquals(null, obj)) return false;
        if (ReferenceEquals(this, obj)) return true;
        if (obj.GetType() != this.GetType()) return false;
        return Equals((Waveform)obj);
    }

    //*********************************************************************
    // IEquatable Interface - implemented with Resharper
    //*********************************************************************
    public override int GetHashCode()
    {
        unchecked
        {
            int hashCode = base.GetHashCode();
            hashCode = (hashCode * 397) ^ m_sweepSpan.GetHashCode();
            hashCode = (hashCode * 397) ^ m_sweepRate.GetHashCode();
            hashCode = (hashCode * 397) ^ m_bandwidth.GetHashCode();
            hashCode = (hashCode * 397) ^ m_centerFrequency.GetHashCode();
            hashCode = (hashCode * 397) ^ (int)m_waveformType;
            hashCode = (hashCode * 397) ^ m_dutyCycle.GetHashCode();
            hashCode = (hashCode * 397) ^ m_pulsePeriod.GetHashCode();
            hashCode = (hashCode * 397) ^ m_modulationFrequency.GetHashCode();
            hashCode = (hashCode * 397) ^ m_relativePowerIncrement.GetHashCode();
            hashCode = (hashCode * 397) ^ m_relativeTimeIncrement.GetHashCode();
            hashCode = (hashCode * 397) ^ m_endRelativePower.GetHashCode();
            hashCode = (hashCode * 397) ^ m_timeRFOn.GetHashCode();
            hashCode = (hashCode * 397) ^ m_timeRFOff.GetHashCode();
            hashCode = (hashCode * 397) ^ (int)m_powerReferenceType;
            hashCode = (hashCode * 397) ^ (m_customTRP != null ? m_customTRP.GetHashCode() : 0);

            return hashCode;
        }
    }