obfuz/Editor/Utils/CollectionExtensions.cs

21 lines
508 B
C#
Raw Normal View History

2025-05-30 13:32:29 +08:00
using System.Collections.Generic;
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);
}
}
}