1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Add TryGetValueAlt to Dictionary

This commit is contained in:
disarray2077 2021-10-27 23:29:03 -03:00
parent f7853fc348
commit 5b02c68372

View file

@ -739,6 +739,18 @@ namespace System.Collections
return false;
}
public bool TryGetValueAlt<TAltKey>(TAltKey key, out TValue value) where TAltKey : IHashable where bool : operator TKey == TAltKey
{
int_cosize i = (int_cosize)FindEntryAlt<TAltKey>(key);
if (i >= 0)
{
value = mEntries[i].mValue;
return true;
}
value = default(TValue);
return false;
}
public bool TryGet(TKey key, out TKey matchKey, out TValue value)
{
int_cosize i = (int_cosize)FindEntry(key);