using System.Collections.Generic; namespace DHT.Server.Collections { public class MultiDictionary where TKey : notnull { private readonly Dictionary> dict = new(); public void Add(TKey key, TValue value) { if (!dict.TryGetValue(key, out var list)) { dict[key] = list = new List(); } list.Add(value); } public List? GetListOrNull(TKey key) { return dict.TryGetValue(key, out var list) ? list : null; } } }