17 using System.Collections.Generic;
20 namespace erminas.SmartAPI.Utils
22 public static class CollectionExtensions
36 public static TValue GetOrAdd<TKey, TValue>(
this Dictionary<TKey, TValue> dictionary, TKey key,
40 if (!dictionary.TryGetValue(key, out result))
43 dictionary.Add(key, result);
48 public static bool SetEquals<T>(
this IEnumerable<T> first, IEnumerable<T> second)
50 var firstList = first as IList<T> ?? first.ToList();
51 var secondList = second as IList<T> ?? second.ToList();
53 return !firstList.Except(secondList).Any() && !secondList.Except(firstList).Any();