2025-05-30 13:32:29 +08:00
|
|
|
|
using System.Collections.Generic;
|
2025-05-21 09:23:29 +08:00
|
|
|
|
|
|
|
|
|
namespace Obfuz.Utils
|
|
|
|
|
{
|
|
|
|
|
public static class CollectionExtensions
|
|
|
|
|
{
|
|
|
|
|
public static void AddRange<T>(this HashSet<T> values, IEnumerable<T> newValues)
|
|
|
|
|
{
|
|
|
|
|
foreach (var value in newValues)
|
|
|
|
|
{
|
|
|
|
|
values.Add(value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static V GetValueOrDefault<K, V>(this Dictionary<K, V> dic, K key)
|
|
|
|
|
{
|
2025-05-30 13:32:29 +08:00
|
|
|
|
return dic.TryGetValue(key, out V v) ? v : default(V);
|
2025-05-21 09:23:29 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|