Exemple #1
0
 public static ImmutableDictionary <T1, ImmutableList <T2> > AddToListOfValues <T1, T2>(this ImmutableDictionary <T1, ImmutableList <T2> > dictionary, T1 key, T2 item)
 {
     return(dictionary.SetItem(key, dictionary.GetOrEmpty(key).Add(item)));
 }
Exemple #2
0
 public static ImmutableDictionary <T1, ImmutableList <T2> > AddNtoM <T1, T2>(this ImmutableDictionary <T1, ImmutableList <T2> > mapping1, ICollection <T1> items1, ICollection <T2> items2)
 {
     return(mapping1.SetItems(
                items1.SelectMany(
                    item1 =>
     {
         return items2.Select(item2 => new KeyValuePair <T1, ImmutableList <T2> >(item1, mapping1.GetOrEmpty(item1).Add(item2)));
     })));
 }