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:
parent
f7853fc348
commit
5b02c68372
1 changed files with 12 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue