2025-04-13 22:41:09 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Obfuz
|
|
|
|
|
{
|
|
|
|
|
public static class CollectionExtensions
|
|
|
|
|
{
|
|
|
|
|
public static void AddRange<T>(this HashSet<T> values, IEnumerable<T> newValues)
|
|
|
|
|
{
|
|
|
|
|
foreach (var value in newValues)
|
|
|
|
|
{
|
|
|
|
|
values.Add(value);
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-04-16 18:05:21 +08:00
|
|
|
|
|
2025-04-19 11:47:05 +08:00
|
|
|
|
public static V GetValueOrDefault<K, V>(this IDictionary<K, V> dic, K key)
|
2025-04-16 18:05:21 +08:00
|
|
|
|
{
|
|
|
|
|
return dic.TryGetValue(key, out V v) ? v : default(V);
|
|
|
|
|
}
|
2025-04-13 22:41:09 +08:00
|
|
|
|
}
|
|
|
|
|
}
|