public int Compare(object x, object y) { CommentKey key = (CommentKey)x; CommentKey key2 = (CommentKey)y; int num = key.DateAdded.CompareTo(key2.DateAdded); if (num == 0) { return(key.Id.CompareTo(key2.Id)); } return(num); }
/// <summary> /// Compares two objects and returns a value indicating whether one is less than, /// equal to or greater than the other. /// </summary> /// <param name="x">First object to compare. </param> /// <param name="y">Second object to compare. </param> /// <returns>Less than zero if x is less than y, zero if x is equal to y or greater than zero if y is greater than x.</returns> public int Compare(object x, object y) { CommentKey dirX = (CommentKey)x; CommentKey dirY = (CommentKey)y; int result = dirX.DateAdded.CompareTo(dirY.DateAdded); if (result == 0) { return(dirX.Id.CompareTo(dirY.Id)); } else { return(result); } }