mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-17 07:34:24 +01:00
18 lines
619 B
C#
18 lines
619 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Relay
|
|
{
|
|
public static class MultiValueDictionaryExtensions
|
|
{
|
|
public static ConcurrentMultiDictionary<TKey, TValue> ToMultiValueDictionary<TInput, TKey, TValue>(this IEnumerable<TInput> collection, Func<TInput, TKey> keySelector, Func<TInput, TValue> valueSelector)
|
|
{
|
|
var dictionary = new ConcurrentMultiDictionary<TKey, TValue>();
|
|
foreach (var item in collection)
|
|
{
|
|
dictionary.Add(keySelector(item), valueSelector(item));
|
|
}
|
|
return dictionary;
|
|
}
|
|
}
|
|
} |