110,534
社区成员
发帖
与我相关
我的任务
分享
/// <summary>
/// A result is a search result which contains a post and its ranking.
/// </summary>
internal class Result : IComparable<Result>
{
#region Constants and Fields
/// <summary>
/// The post of the result.
/// </summary>
internal IPublishable Item;
/// <summary>
/// The rank of the post based on the search term. The higher the rank, the higher the post is in the result set.
/// </summary>
internal int Rank;
#endregion
#region Public Methods
/// <summary>
/// Returns a hash code for this instance.
/// </summary>
/// <returns>
/// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
/// </returns>
public override int GetHashCode()
{
return this.Item.Id.GetHashCode();
}
#endregion
#region Implemented Interfaces
#region IComparable<Result>
/// <summary>
/// Compares the current object with another object of the same type.
/// </summary>
/// <param name="other">
/// An object to compare with this object.
/// </param>
/// <returns>
/// A 32-bit signed integer that indicates the relative order of the objects being compared. The return value
/// has the following meanings: Value Meaning Less than zero This object is less than the other parameter.Zero
/// This object is equal to other. Greater than zero This object is greater than other.
/// </returns>
public int CompareTo(Result other)
{
return other.Rank.CompareTo(this.Rank);
}
#endregion
#endregion
}