diff --git a/BeefLibs/corlib/src/Collections/Dictionary.bf b/BeefLibs/corlib/src/Collections/Dictionary.bf index 03135d23..493a3309 100644 --- a/BeefLibs/corlib/src/Collections/Dictionary.bf +++ b/BeefLibs/corlib/src/Collections/Dictionary.bf @@ -277,6 +277,19 @@ namespace System.Collections return false; } } + + public bool ContainsAlt((TAltKey key, TValue value) kvPair) where TAltKey : IHashable where bool : operator TKey == TAltKey + { + TValue value; + if (TryGetValueAlt(kvPair.key, out value)) + { + return value == kvPair.value; + } + else + { + return false; + } + } public void CopyTo(Span kvPair) { @@ -739,6 +752,18 @@ namespace System.Collections return false; } + public bool TryGetValueAlt(TAltKey key, out TValue value) where TAltKey : IHashable where bool : operator TKey == TAltKey + { + int_cosize i = (int_cosize)FindEntryAlt(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);