using System.Collections.Generic;
namespace Semmle.Util
{
public static class DictionaryExtensions
{
///
/// Adds another element to the list for the given key in this
/// dictionary. If a list does not already exist, a new list is
/// created.
///
public static void AddAnother(this Dictionary> dict, T1 key, T2 element)
{
List list;
if (!dict.TryGetValue(key, out list))
{
list = new List();
dict[key] = list;
}
list.Add(element);
}
}
}