summary refs log tree commit diff
path: root/crypto/src/asn1/isismtt/x509/Admissions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/isismtt/x509/Admissions.cs')
-rw-r--r--crypto/src/asn1/isismtt/x509/Admissions.cs59
1 files changed, 26 insertions, 33 deletions
diff --git a/crypto/src/asn1/isismtt/x509/Admissions.cs b/crypto/src/asn1/isismtt/x509/Admissions.cs
index 2aa6764bb..42ebceb1c 100644
--- a/crypto/src/asn1/isismtt/x509/Admissions.cs
+++ b/crypto/src/asn1/isismtt/x509/Admissions.cs
@@ -1,5 +1,4 @@
 using System;
-using System.Collections;
 
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Utilities;
@@ -30,18 +29,13 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509
 		private readonly NamingAuthority	namingAuthority;
 		private readonly Asn1Sequence		professionInfos;
 
-		public static Admissions GetInstance(
-			object obj)
+		public static Admissions GetInstance(object obj)
 		{
 			if (obj == null || obj is Admissions)
-			{
-				return (Admissions) obj;
-			}
+				return (Admissions)obj;
 
-			if (obj is Asn1Sequence)
-			{
-				return new Admissions((Asn1Sequence) obj);
-			}
+			if (obj is Asn1Sequence seq)
+				return new Admissions(seq);
 
             throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj");
 		}
@@ -62,44 +56,43 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509
 		*
 		* @param seq The ASN.1 sequence.
 		*/
-		private Admissions(
-			Asn1Sequence seq)
+		private Admissions(Asn1Sequence seq)
 		{
 			if (seq.Count > 3)
 				throw new ArgumentException("Bad sequence size: " + seq.Count);
 
-			IEnumerator e = seq.GetEnumerator();
+			var e = seq.GetEnumerator();
 
 			e.MoveNext();
-			Asn1Encodable o = (Asn1Encodable) e.Current;
-			if (o is Asn1TaggedObject)
+			Asn1Encodable o = e.Current;
+			if (o is Asn1TaggedObject tagged1)
 			{
-				switch (((Asn1TaggedObject)o).TagNo)
+				switch (tagged1.TagNo)
 				{
-					case 0:
-						admissionAuthority = GeneralName.GetInstance((Asn1TaggedObject)o, true);
-						break;
-					case 1:
-						namingAuthority = NamingAuthority.GetInstance((Asn1TaggedObject)o, true);
-						break;
-					default:
-						throw new ArgumentException("Bad tag number: " + ((Asn1TaggedObject)o).TagNo);
+				case 0:
+					admissionAuthority = GeneralName.GetInstance((Asn1TaggedObject)o, true);
+					break;
+				case 1:
+					namingAuthority = NamingAuthority.GetInstance((Asn1TaggedObject)o, true);
+					break;
+				default:
+					throw new ArgumentException("Bad tag number: " + ((Asn1TaggedObject)o).TagNo);
 				}
 				e.MoveNext();
-				o = (Asn1Encodable) e.Current;
+				o = e.Current;
 			}
-			if (o is Asn1TaggedObject)
+			if (o is Asn1TaggedObject tagged2)
 			{
-				switch (((Asn1TaggedObject)o).TagNo)
+				switch (tagged2.TagNo)
 				{
-					case 1:
-						namingAuthority = NamingAuthority.GetInstance((Asn1TaggedObject)o, true);
-						break;
-					default:
-						throw new ArgumentException("Bad tag number: " + ((Asn1TaggedObject)o).TagNo);
+				case 1:
+					namingAuthority = NamingAuthority.GetInstance((Asn1TaggedObject)o, true);
+					break;
+				default:
+					throw new ArgumentException("Bad tag number: " + ((Asn1TaggedObject)o).TagNo);
 				}
 				e.MoveNext();
-				o = (Asn1Encodable) e.Current;
+				o = e.Current;
 			}
 			professionInfos = Asn1Sequence.GetInstance(o);
 			if (e.MoveNext())