diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-27 02:19:14 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-27 02:19:14 +0700 |
commit | 4ea1816cffd5c8663bc9ae1234df0a70ef23fcd6 (patch) | |
tree | eb4fe294ef230435928a573fadef3047b4466e9b /crypto/src/util/collections/CollectionUtilities.cs | |
parent | Implement generic IEnumerable in ASN.1 classes (diff) | |
download | BouncyCastle.NET-ed25519-4ea1816cffd5c8663bc9ae1234df0a70ef23fcd6.tar.xz |
Generics migration work
Diffstat (limited to 'crypto/src/util/collections/CollectionUtilities.cs')
-rw-r--r-- | crypto/src/util/collections/CollectionUtilities.cs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/src/util/collections/CollectionUtilities.cs b/crypto/src/util/collections/CollectionUtilities.cs index 426700903..97bc374e1 100644 --- a/crypto/src/util/collections/CollectionUtilities.cs +++ b/crypto/src/util/collections/CollectionUtilities.cs @@ -45,9 +45,10 @@ namespace Org.BouncyCastle.Utilities.Collections return new StoreImpl<T>(contents); } - public static IEnumerable Proxy(IEnumerable e) + public static V GetValueOrNull<K, V>(IDictionary<K, V> d, K k) + where V : class { - return new EnumerableProxy(e); + return d.TryGetValue(k, out var v) ? v : null; } public static IEnumerable<T> Proxy<T>(IEnumerable<T> e) |