wasSharp – Diff between revs 18 and 20
?pathlinks?
Rev 18 | Rev 20 | |||
---|---|---|---|---|
Line 2... | Line 2... | |||
2 | // Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 // |
2 | // Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 // |
|
3 | // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // |
3 | // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // |
|
4 | // rights of fair usage, the disclaimer and warranty conditions. // |
4 | // rights of fair usage, the disclaimer and warranty conditions. // |
|
5 | /////////////////////////////////////////////////////////////////////////// |
5 | /////////////////////////////////////////////////////////////////////////// |
|
Line -... | Line 6... | |||
- | 6 | |
||
6 | |
7 | using System; |
|
7 | using System.Collections.Generic; |
8 | using System.Collections.Generic; |
|
- | 9 | using System.Linq; |
||
Line 8... | Line 10... | |||
8 | using System.Linq; |
10 | using wasSharp.Collections.Specialized; |
|
9 | |
11 | |
|
10 | namespace wasSharp.Collections.Utilities |
12 | namespace wasSharp.Collections.Utilities |
|
11 | { |
13 | { |
|
Line 51... | Line 53... | |||
51 | case true: |
53 | case true: |
|
52 | dictionary.Add(key, value); |
54 | dictionary.Add(key, value); |
|
53 | break; |
55 | break; |
|
54 | } |
56 | } |
|
55 | } |
57 | } |
|
- | 58 | |
||
- | 59 | public static MultiKeyDictionary<K1, K2, V> ToMultiKeyDictionary<S, K1, K2, V>(this IEnumerable<S> items, Func<S, K1> key1, Func<S, K2> key2, Func<S, V> value) |
||
- | 60 | { |
||
- | 61 | var dict = new MultiKeyDictionary<K1, K2, V>(); |
||
- | 62 | foreach (S i in items) |
||
- | 63 | { |
||
- | 64 | dict.Add(key1(i), key2(i), value(i)); |
||
- | 65 | } |
||
- | 66 | return dict; |
||
- | 67 | } |
||
56 | } |
68 | } |
|
57 | } |
69 | } |
|
58 | |
70 | |