summary refs log tree commit diff
path: root/crypto/src/asn1/Asn1RelativeOid.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/Asn1RelativeOid.cs')
-rw-r--r--crypto/src/asn1/Asn1RelativeOid.cs22
1 files changed, 12 insertions, 10 deletions
diff --git a/crypto/src/asn1/Asn1RelativeOid.cs b/crypto/src/asn1/Asn1RelativeOid.cs
index a1997864d..3c4bf237a 100644
--- a/crypto/src/asn1/Asn1RelativeOid.cs
+++ b/crypto/src/asn1/Asn1RelativeOid.cs
@@ -29,21 +29,23 @@ namespace Org.BouncyCastle.Asn1
 
         public static Asn1RelativeOid GetInstance(object obj)
         {
-            if (obj == null || obj is Asn1RelativeOid)
-            {
-                return (Asn1RelativeOid)obj;
-            }
-            else if (obj is IAsn1Convertible)
+            if (obj == null)
+                return null;
+
+            if (obj is Asn1RelativeOid asn1RelativeOid)
+                return asn1RelativeOid;
+
+            if (obj is IAsn1Convertible asn1Convertible)
             {
-                Asn1Object asn1Object = ((IAsn1Convertible)obj).ToAsn1Object();
-                if (asn1Object is Asn1RelativeOid)
-                    return (Asn1RelativeOid)asn1Object;
+                Asn1Object asn1Object = asn1Convertible.ToAsn1Object();
+                if (asn1Object is Asn1RelativeOid converted)
+                    return converted;
             }
-            else if (obj is byte[])
+            else if (obj is byte[] bytes)
             {
                 try
                 {
-                    return (Asn1RelativeOid)FromByteArray((byte[])obj);
+                    return (Asn1RelativeOid)FromByteArray(bytes);
                 }
                 catch (IOException e)
                 {