From 5b2801cbae8cc88a3b753ab5b0366ee30c867756 Mon Sep 17 00:00:00 2001 From: disarray2077 <86157825+disarray2077@users.noreply.github.com> Date: Wed, 27 Oct 2021 23:37:09 -0300 Subject: [PATCH] Add ContainsAlt to Dictionary --- BeefLibs/corlib/src/Collections/Dictionary.bf | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/BeefLibs/corlib/src/Collections/Dictionary.bf b/BeefLibs/corlib/src/Collections/Dictionary.bf index 7d0bf19e..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) {