public int CompareTo(ExpenditureByTerritory other) { const StringComparison comparisonIgnoreCase = StringComparison.OrdinalIgnoreCase; if (ReferenceEquals(this, other)) { return(0); } if (ReferenceEquals(null, other)) { return(1); } var monthIdComparison = MonthId.CompareTo(other.MonthId); if (monthIdComparison != 0) { return(monthIdComparison); } var monthComparison = string.Compare(Month, other.Month, comparisonIgnoreCase); if (monthComparison != 0) { return(monthComparison); } var productNameComparison = string.Compare(ProductName, other.ProductName, comparisonIgnoreCase); if (productNameComparison != 0) { return(productNameComparison); } var companyNameComparison = string.Compare(CompanyName, other.CompanyName, comparisonIgnoreCase); if (companyNameComparison != 0) { return(companyNameComparison); } var summRbComparison = SummRb.CompareTo(other.SummRb); if (summRbComparison != 0) { return(summRbComparison); } var summUsdComparison = SummUsd.CompareTo(other.SummUsd); if (summUsdComparison != 0) { return(summUsdComparison); } return(string.Compare(MoneyOrBarter, other.MoneyOrBarter, comparisonIgnoreCase)); }
public override int GetHashCode() { unchecked { var hashCode = MonthId; hashCode = (hashCode * 397) ^ (Month != null ? StringComparer.OrdinalIgnoreCase.GetHashCode(Month) : 0); hashCode = (hashCode * 397) ^ (CompanyName != null ? StringComparer.OrdinalIgnoreCase.GetHashCode(CompanyName) : 0); hashCode = (hashCode * 397) ^ (ProductName != null ? StringComparer.OrdinalIgnoreCase.GetHashCode(ProductName) : 0); hashCode = (hashCode * 397) ^ SummRb.GetHashCode(); hashCode = (hashCode * 397) ^ SummUsd.GetHashCode(); hashCode = (hashCode * 397) ^ (MoneyOrBarter != null ? StringComparer.OrdinalIgnoreCase.GetHashCode(MoneyOrBarter) : 0); return(hashCode); } }