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/x509/qualified/SemanticsInformation.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/x509/qualified/SemanticsInformation.cs')
-rw-r--r-- | crypto/src/asn1/x509/qualified/SemanticsInformation.cs | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/crypto/src/asn1/x509/qualified/SemanticsInformation.cs b/crypto/src/asn1/x509/qualified/SemanticsInformation.cs index 379e6d1d1..23818e916 100644 --- a/crypto/src/asn1/x509/qualified/SemanticsInformation.cs +++ b/crypto/src/asn1/x509/qualified/SemanticsInformation.cs @@ -1,7 +1,5 @@ using System; -using System.Collections; -using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509.Qualified @@ -42,33 +40,30 @@ namespace Org.BouncyCastle.Asn1.X509.Qualified throw new ArgumentException("unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } - public SemanticsInformation( - Asn1Sequence seq) + public SemanticsInformation(Asn1Sequence seq) { if (seq.Count < 1) - { throw new ArgumentException("no objects in SemanticsInformation"); - } - IEnumerator e = seq.GetEnumerator(); + var e = seq.GetEnumerator(); e.MoveNext(); - object obj = e.Current; - if (obj is DerObjectIdentifier) + var obj = e.Current; + if (obj is DerObjectIdentifier oid) { - semanticsIdentifier = DerObjectIdentifier.GetInstance(obj); + semanticsIdentifier = oid; if (e.MoveNext()) { - obj = e.Current; + obj = e.Current; } else { - obj = null; + obj = null; } } - if (obj != null) + if (obj != null) { - Asn1Sequence generalNameSeq = Asn1Sequence.GetInstance(obj ); + Asn1Sequence generalNameSeq = Asn1Sequence.GetInstance(obj); nameRegistrationAuthorities = new GeneralName[generalNameSeq.Count]; for (int i= 0; i < generalNameSeq.Count; i++) { @@ -97,7 +92,10 @@ namespace Org.BouncyCastle.Asn1.X509.Qualified this.nameRegistrationAuthorities = generalNames; } - public DerObjectIdentifier SemanticsIdentifier { get { return semanticsIdentifier; } } + public DerObjectIdentifier SemanticsIdentifier + { + get { return semanticsIdentifier; } + } public GeneralName[] GetNameRegistrationAuthorities() { |