2025-09-17 16:40:02 -07:00

17 lines
366 B
C#

namespace AssetRipper.AssemblyDumper.Extensions;
internal static class DictionaryExtensions
{
public static TValue GetOrAdd<TKey, TValue>(this Dictionary<TKey, TValue> dict, TKey key)
where TKey : notnull
where TValue : new()
{
if (!dict.TryGetValue(key, out TValue? value))
{
value = new TValue();
dict.Add(key, value);
}
return value;
}
}