private int compareTo(UserRanking x, UserRanking y) { int result = y.Score - x.Score; if (result == 0) { result = y.UserID - x.UserID; } return result; }
public override bool TakeAction() { var cache = new ShareCacheStruct<UserRanking>(); var ranking = cache.Find(m => m.UserName == UserName); if (ranking == null) { ranking = new UserRanking(); ranking.UserID = (int)cache.GetNextNo(); ranking.UserName = UserName; ranking.Score = Score; cache.Add(ranking); } else { ranking.UserName = UserName; ranking.Score = Score; } return true; }