CSharp examples for System.Collections.Generic:ISet
Combined Set
using System.Collections.Generic; using System;//from w w w . j a v a 2 s . co m public class Main{ public static ISet<X> CombinedSet<X> (params X[][] arrays) { var r = new HashSet<X> (); foreach (var i in arrays) { r.AddAll (i); } return r; } public static ISet<X> CombinedSet<T, X> (params T[] collections) where T : class, ICollection<X>, new() { var r = new HashSet<X> (); foreach (var i in collections) { r.AddAll (i); } return r; } public static void AddAll<T> (this ICollection<T> me, IEnumerable<T> other) { foreach (var i in other) { me.Add (i); } } public static void AddAll<TKey, TValue> (this IDictionary<TKey, TValue> me, IDictionary<TKey, TValue> other) { foreach (var i in other) { me [i.Key] = i.Value; } } }