You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
428 B
C#
18 lines
428 B
C#
using System.Collections.Generic;
|
|
|
|
namespace EntrustSettle.Common.Extensions;
|
|
|
|
public static class DictionaryExtensions
|
|
{
|
|
public static void TryAdd<TKey, TValue>(this IDictionary<TKey, List<TValue>> dic, TKey key, TValue value)
|
|
{
|
|
if (dic.TryGetValue(key, out var old))
|
|
{
|
|
old.Add(value);
|
|
}
|
|
else
|
|
{
|
|
dic.Add(key, new List<TValue> {value});
|
|
}
|
|
}
|
|
} |