I am building a plugin for a LAN party website that I wrote that would allow the use of a Round Robin tournament.
All is going well, but I have some questions about
Assuming you have a List
structure where the Result
object has the following parameters...
Pesron - string
Rank - int
Wins - double
TotalScore - int
You could write a custom comparer, and then pass that to List.Sort(Comparison
Alternative, you could just make your Result
object implement IComparable
and stick this in your class.
#region IComparable Members
public int CompareTo(Result obj)
{
if (this.Rank.CompareTo(obj.Rank) != 0)
return this.Rank.CompareTo(obj.Rank);
if (this.Wins.CompareTo(obj.Wins) != 0)
return (this.Wins.CompareTo(obj.Wins);
return (this.TotalScore.CompareTo(obj.TotalScore) ;
}
#endregion
Then you can just call List
;