diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-09-14 17:25:07 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-09-14 17:25:07 +0700 |
commit | 70efdd3343573c6c2686486cf308490dd4a20d24 (patch) | |
tree | 396eb8424871e4e65656866191d851e53f151169 /crypto/src/asn1/Asn1Set.cs | |
parent | DateTimeObject => nullable DateTime (diff) | |
download | BouncyCastle.NET-ed25519-70efdd3343573c6c2686486cf308490dd4a20d24.tar.xz |
Add MapElements methods
Diffstat (limited to 'crypto/src/asn1/Asn1Set.cs')
-rw-r--r-- | crypto/src/asn1/Asn1Set.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/src/asn1/Asn1Set.cs b/crypto/src/asn1/Asn1Set.cs index 1045b7f74..b2a654d68 100644 --- a/crypto/src/asn1/Asn1Set.cs +++ b/crypto/src/asn1/Asn1Set.cs @@ -162,6 +162,18 @@ namespace Org.BouncyCastle.Asn1 get { return elements.Length; } } + public virtual T[] MapElements<T>(Func<Asn1Encodable, T> func) + { + // NOTE: Call Count here to 'force' a LazyDerSet + int count = Count; + T[] result = new T[count]; + for (int i = 0; i < count; ++i) + { + result[i] = func(elements[i]); + } + return result; + } + public virtual Asn1Encodable[] ToArray() { return Asn1EncodableVector.CloneElements(elements); |