private static Dictionary<int, int> GetPayouts(MatchData matchData) { var balances = matchData.Balances.Where(x => x.Id > 19500).ToList(); var payouts = new Dictionary<int, int>(); var firstBalance = balances.First(); balances.Remove(firstBalance); foreach (var balance in balances) { var amount = balance.Balance - firstBalance.Balance; if (firstBalance.Balance == 0) amount = 0; payouts.Add(firstBalance.Id, amount); firstBalance = balance; } return payouts; }
private static List<KeyValuePair<int, int>> GetBiggestPayouts(MatchData matchData, int numOfPayouts) { return GetPayouts(matchData).OrderByDescending(x => x.Value).Take(numOfPayouts).ToList(); }