public int Compare(object x, object y) { PhotoKey key = (PhotoKey)x; PhotoKey key2 = (PhotoKey)y; int num = key.DateTaken.CompareTo(key2.DateTaken); if (num == 0) { return(key.Name.CompareTo(key2.Name)); } 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) { PhotoKey dirX = (PhotoKey)x; PhotoKey dirY = (PhotoKey)y; int result = dirX.DateTaken.CompareTo(dirY.DateTaken); if (result == 0) { return(dirX.Name.CompareTo(dirY.Name)); } else { return(result); } }