A game where you get to play as a slime, made with Godot.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
public static class CollectionExtensions |
|
{ |
|
public static TValue GetOrAddNew<TKey, TValue>( |
|
this Dictionary<TKey, TValue> dict, TKey key) |
|
where TValue : new() |
|
{ |
|
if (!dict.TryGetValue(key, out var value)) |
|
dict.Add(key, value = new()); |
|
return value; |
|
} |
|
}
|
|
|