wasSharp
/Collections/Utilities/CollectionExtensions.cs |
@@ -4,8 +4,10 @@ |
// rights of fair usage, the disclaimer and warranty conditions. // |
/////////////////////////////////////////////////////////////////////////// |
|
using System; |
using System.Collections.Generic; |
using System.Linq; |
using wasSharp.Collections.Specialized; |
|
namespace wasSharp.Collections.Utilities |
{ |
@@ -53,5 +55,15 @@ |
break; |
} |
} |
|
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) |
{ |
var dict = new MultiKeyDictionary<K1, K2, V>(); |
foreach (S i in items) |
{ |
dict.Add(key1(i), key2(i), value(i)); |
} |
return dict; |
} |
} |
} |