using System.Collections.Generic;
static Dictionary<ulong, int> rawTwitchVotesByPlayer;
static Dictionary<ulong,int> convertedPlayerVotesByPlayer;
public static void Main()
Console.WriteLine("Hello World");
rawTwitchVotesByPlayer = new() {
{18446744073709551614, 1},
{18446744073709551615, 0}
convertedPlayerVotesByPlayer = new() {
{18446744073709551615, 2},
{18446744073709551614, 1},
private static Dictionary<ulong, int> GetTotalVotesByPlayer()
Dictionary<ulong, int> totalVotesByPlayer = new();
foreach (var pair in rawTwitchVotesByPlayer.Concat(convertedPlayerVotesByPlayer))
if (!totalVotesByPlayer.ContainsKey(pair.Key))
totalVotesByPlayer[pair.Key] = 0;
totalVotesByPlayer[pair.Key] += pair.Value;
Console.WriteLine("RAW" + ToStringFancy(rawTwitchVotesByPlayer));
Console.WriteLine("CONVERTED" + ToStringFancy(convertedPlayerVotesByPlayer));
Console.WriteLine(ToStringFancy(totalVotesByPlayer));
return totalVotesByPlayer;
public static string ToStringFancy<T,U>(IReadOnlyDictionary<T,U> dictionary,
Func<T,string> keyWriter = null, Func<U,string> valueWriter = null)
StringBuilder stringBuilder = new();
stringBuilder.AppendLine("Dictionary : ");
foreach (T key in dictionary.Keys)
string keyString = keyWriter == null ? key.ToString() : keyWriter(key);
string valueString = valueWriter == null ?
dictionary[key].ToString() : valueWriter(dictionary[key]);
stringBuilder.AppendLine($"[{keyString} : {valueString}]");
return stringBuilder.ToString();