diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-24 20:37:41 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-24 20:37:41 +0700 |
commit | 110f936da13a1639a83edc512c5c104d2f5694a7 (patch) | |
tree | 6edf3f33b1b173348ccf2dfa639fe03979d336c3 /crypto/src/util | |
parent | Remove bridging version of Curve25519 (diff) | |
download | BouncyCastle.NET-ed25519-110f936da13a1639a83edc512c5c104d2f5694a7.tar.xz |
Update EC curve registry classes
Diffstat (limited to 'crypto/src/util')
-rw-r--r-- | crypto/src/util/collections/CollectionUtilities.cs | 11 | ||||
-rw-r--r-- | crypto/src/util/collections/EnumerableProxy.cs | 25 |
2 files changed, 36 insertions, 0 deletions
diff --git a/crypto/src/util/collections/CollectionUtilities.cs b/crypto/src/util/collections/CollectionUtilities.cs index 35ee60e41..37551e5b3 100644 --- a/crypto/src/util/collections/CollectionUtilities.cs +++ b/crypto/src/util/collections/CollectionUtilities.cs @@ -1,5 +1,6 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Text; namespace Org.BouncyCastle.Utilities.Collections @@ -14,6 +15,16 @@ namespace Org.BouncyCastle.Utilities.Collections } } + public static IEnumerable Proxy(IEnumerable e) + { + return new EnumerableProxy(e); + } + + public static IEnumerable<T> Proxy<T>(IEnumerable<T> e) + { + return new EnumerableProxy<T>(e); + } + public static IDictionary ReadOnly(IDictionary d) { return new UnmodifiableDictionaryProxy(d); diff --git a/crypto/src/util/collections/EnumerableProxy.cs b/crypto/src/util/collections/EnumerableProxy.cs index 9eec4af21..196b4d9df 100644 --- a/crypto/src/util/collections/EnumerableProxy.cs +++ b/crypto/src/util/collections/EnumerableProxy.cs @@ -1,5 +1,6 @@ using System; using System.Collections; +using System.Collections.Generic; namespace Org.BouncyCastle.Utilities.Collections { @@ -22,4 +23,28 @@ namespace Org.BouncyCastle.Utilities.Collections return inner.GetEnumerator(); } } + + internal sealed class EnumerableProxy<T> + : IEnumerable<T> + { + private readonly IEnumerable<T> m_inner; + + internal EnumerableProxy(IEnumerable<T> inner) + { + if (inner == null) + throw new ArgumentNullException("inner"); + + m_inner = inner; + } + + IEnumerator IEnumerable.GetEnumerator() + { + return m_inner.GetEnumerator(); + } + + IEnumerator<T> IEnumerable<T>.GetEnumerator() + { + return m_inner.GetEnumerator(); + } + } } |