/// <summary> /// 用作特定类型的哈希函数。 /// </summary> /// <returns>当前Object的哈希代码。</returns> /// <remarks> /// 有关此函数的更多信息,请参见:http://msdn.microsoft.com/zh-cn/library/system.object.gethashcode。 /// </remarks> public override int GetHashCode() { return(TotalPages.GetHashCode() ^ TotalRecords.GetHashCode() ^ PageNumber.GetHashCode() ^ PageSize.GetHashCode()); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (TotalRecords != null) { hashCode = hashCode * 59 + TotalRecords.GetHashCode(); } if (TotalPages != null) { hashCode = hashCode * 59 + TotalPages.GetHashCode(); } return(hashCode); } }