wasSharp – Diff between revs 12 and 17

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 12 Rev 17
Line 28... Line 28...
28 (otherDictionary ?? new Dictionary<TKey, TValue>()) 28 (otherDictionary ?? new Dictionary<TKey, TValue>())
29 .OrderBy(kvp => kvp.Key) 29 .OrderBy(kvp => kvp.Key)
30 .SequenceEqual((dictionary ?? new Dictionary<TKey, TValue>()) 30 .SequenceEqual((dictionary ?? new Dictionary<TKey, TValue>())
31 .OrderBy(kvp => kvp.Key)); 31 .OrderBy(kvp => kvp.Key));
32 } 32 }
-   33  
-   34 public static void AddOrReplace<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue value)
-   35 {
-   36 switch (dictionary.ContainsKey(key))
-   37 {
-   38 case true:
-   39 dictionary[key] = value;
-   40 break;
-   41 default:
-   42 dictionary.Add(key, value);
-   43 break;
-   44 }
-   45 }
-   46  
-   47 public static void AddIfNotExists<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue value)
-   48 {
-   49 switch (!dictionary.ContainsKey(key))
-   50 {
-   51 case true:
-   52 dictionary.Add(key, value);
-   53 break;
-   54 }
-   55 }
33 } 56 }
34 } 57 }
35   58