I created a class which implemented "IComparable" for comparing "Players". In my code I am comparing 2 players, but I'm not hitting a breakpoint on my "CompareTo()" method in the Player class. Here is a summary of the class:
And the code which should trigger the comparison:Code:[Serializable()] public class Player : BaseSheet, IComparable { /// <summary> /// This method allows us to check the equality of two players. If they are equal the method will return a zero. The greater /// than or less than have no relevance for a Player object /// </summary> /// <param name="obj"></param> /// <returns></returns> public int CompareTo(object obj) { Player passedPlayer = (Player)obj; if (this.PlayerID == passedPlayer.PlayerID) { return 0; } else if (this.PlayerID > passedPlayer.PlayerID) { return 1; } else { return 0; } } }
Code:foreach (FOOCheatSheetItem currentUserSheetItem in this.UserSheetItems) { // make sure each player sheet is ranked by CSWR FOOSupplementalSheetItem cswrSportsItem = this.CSWRSuppSheetItems.Find(delegate(FOOSupplementalSheetItem targetItem) { return (currentUserSheetItem.Player == targetItem.Player); }); }



Reply With Quote





Bookmarks