wasSharp – Diff between revs 45 and 54

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 45 Rev 54
Line 24... Line 24...
24 /// <returns>true if the dictionaries contain the same elements</returns> 24 /// <returns>true if the dictionaries contain the same elements</returns>
25 public static bool ContentEquals<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, 25 public static bool ContentEquals<TKey, TValue>(this IDictionary<TKey, TValue> dictionary,
26 IDictionary<TKey, TValue> otherDictionary) 26 IDictionary<TKey, TValue> otherDictionary)
27 { 27 {
28 return 28 return
29 (dictionary ?? new Dictionary<TKey, TValue>()).Count.Equals( 29 (dictionary ?? new Dictionary<TKey, TValue>()).Count().Equals(
30 (otherDictionary ?? new Dictionary<TKey, TValue>()).Count) && 30 (otherDictionary ?? new Dictionary<TKey, TValue>()).Count()) &&
31 (otherDictionary ?? new Dictionary<TKey, TValue>()) 31 (otherDictionary ?? new Dictionary<TKey, TValue>())
32 .OrderBy(kvp => kvp.Key) 32 .OrderBy(kvp => kvp.Key)
33 .SequenceEqual((dictionary ?? new Dictionary<TKey, TValue>()) 33 .SequenceEqual((dictionary ?? new Dictionary<TKey, TValue>())
34 .OrderBy(kvp => kvp.Key)); 34 .OrderBy(kvp => kvp.Key));
35 } 35 }
Line 57... Line 57...
57 dictionary.Add(key, value); 57 dictionary.Add(key, value);
58 break; 58 break;
59 } 59 }
60 } 60 }
Line 61... Line 61...
61   61  
62 public static MultiKeyDictionary<K1, K2, V> ToMultiKeyDictionary<S, K1, K2, V>(this IEnumerable<S> items, 62 public static ConcurrentMultiKeyDictionary<K1, K2, V> ToMultiKeyDictionary<S, K1, K2, V>(this IEnumerable<S> items,
63 Func<S, K1> key1, Func<S, K2> key2, Func<S, V> value) 63 Func<S, K1> key1, Func<S, K2> key2, Func<S, V> value)
64 { 64 {
65 var dict = new MultiKeyDictionary<K1, K2, V>(); 65 var dict = new ConcurrentMultiKeyDictionary<K1, K2, V>();
66 foreach (var i in items) 66 foreach (var i in items)
67 { 67 {
68 dict.Add(key1(i), key2(i), value(i)); 68 dict.Add(key1(i), key2(i), value(i));
69 } 69 }