summary refs log tree commit diff
path: root/crypto/src/asn1/x509/Target.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-07-14 15:07:49 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-07-14 15:07:49 +0700
commitdc8b86c13c769e6de9a5c38e3c67921b034a2394 (patch)
treeb79eb20bc7ed797e7624ccb5ceb8293ed429751e /crypto/src/asn1/x509/Target.cs
parentRefactor using MapElements (diff)
downloadBouncyCastle.NET-ed25519-dc8b86c13c769e6de9a5c38e3c67921b034a2394.tar.xz
Refactoring in Asn1
Diffstat (limited to 'crypto/src/asn1/x509/Target.cs')
-rw-r--r--crypto/src/asn1/x509/Target.cs25
1 files changed, 10 insertions, 15 deletions
diff --git a/crypto/src/asn1/x509/Target.cs b/crypto/src/asn1/x509/Target.cs
index 7c4f9db7e..eff740143 100644
--- a/crypto/src/asn1/x509/Target.cs
+++ b/crypto/src/asn1/x509/Target.cs
@@ -32,7 +32,7 @@ namespace Org.BouncyCastle.Asn1.X509
 		private readonly GeneralName targetName;
 		private readonly GeneralName targetGroup;
 
-		/**
+        /**
 		* Creates an instance of a Target from the given object.
 		* <p>
 		* <code>obj</code> can be a Target or a {@link Asn1TaggedObject}</p>
@@ -42,29 +42,24 @@ namespace Org.BouncyCastle.Asn1.X509
 		* @throws ArgumentException if the given object cannot be
 		*             interpreted as Target.
 		*/
-		public static Target GetInstance(
-			object obj)
-		{
-			if (obj is Target)
-			{
-				return (Target) obj;
-			}
+        public static Target GetInstance(object obj)
+        {
+            if (obj is Target target)
+                return target;
 
-			if (obj is Asn1TaggedObject)
-			{
-				return new Target((Asn1TaggedObject) obj);
-			}
+            if (obj is Asn1TaggedObject taggedObject)
+                return new Target(taggedObject);
 
             throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj");
-		}
+        }
 
-		/**
+        /**
 		 * Constructor from Asn1TaggedObject.
 		 * 
 		 * @param tagObj The tagged object.
 		 * @throws ArgumentException if the encoding is wrong.
 		 */
-		private Target(
+        private Target(
 			Asn1TaggedObject tagObj)
 		{
 			switch ((Choice) tagObj.TagNo)