diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-27 21:11:59 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-27 21:11:59 +0700 |
commit | 35cfd51633bbbbc92c2c17c76646e9a9dc945b11 (patch) | |
tree | 563cda15bf08c63de832198be2b9e0263bae5e60 /crypto/src/asn1/smime/SMIMECapabilities.cs | |
parent | Split up fast/slow tests (diff) | |
download | BouncyCastle.NET-ed25519-35cfd51633bbbbc92c2c17c76646e9a9dc945b11.tar.xz |
Generics migration in Asn1
Diffstat (limited to 'crypto/src/asn1/smime/SMIMECapabilities.cs')
-rw-r--r-- | crypto/src/asn1/smime/SMIMECapabilities.cs | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/crypto/src/asn1/smime/SMIMECapabilities.cs b/crypto/src/asn1/smime/SMIMECapabilities.cs index 0bfa05034..0142f0797 100644 --- a/crypto/src/asn1/smime/SMIMECapabilities.cs +++ b/crypto/src/asn1/smime/SMIMECapabilities.cs @@ -1,7 +1,6 @@ using System; -using System.Collections; +using System.Collections.Generic; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.Nist; using Org.BouncyCastle.Asn1.Pkcs; using Org.BouncyCastle.Asn1.X509; @@ -76,35 +75,22 @@ namespace Org.BouncyCastle.Asn1.Smime * matching the passed in capability Oid. If the Oid passed is null the * entire set is returned. */ - public IList GetCapabilitiesForOid( - DerObjectIdentifier capability) + public IList<SmimeCapability> GetCapabilitiesForOid(DerObjectIdentifier capability) { - IList list = Platform.CreateArrayList(); + var list = new List<SmimeCapability>(); DoGetCapabilitiesForOid(capability, list); return list; } - private void DoGetCapabilitiesForOid(DerObjectIdentifier capability, IList list) + private void DoGetCapabilitiesForOid(DerObjectIdentifier capability, IList<SmimeCapability> list) { - if (capability == null) + foreach (object o in capabilities) { - foreach (object o in capabilities) - { - SmimeCapability cap = SmimeCapability.GetInstance(o); + SmimeCapability cap = SmimeCapability.GetInstance(o); - list.Add(cap); - } - } - else - { - foreach (object o in capabilities) - { - SmimeCapability cap = SmimeCapability.GetInstance(o); - - if (capability.Equals(cap.CapabilityID)) - { - list.Add(cap); - } + if (capability == null || capability.Equals(cap.CapabilityID)) + { + list.Add(cap); } } } |