diff options
Diffstat (limited to 'crypto/src/asn1/DerVideotexString.cs')
-rw-r--r-- | crypto/src/asn1/DerVideotexString.cs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/crypto/src/asn1/DerVideotexString.cs b/crypto/src/asn1/DerVideotexString.cs index a5fbe0602..636af0499 100644 --- a/crypto/src/asn1/DerVideotexString.cs +++ b/crypto/src/asn1/DerVideotexString.cs @@ -29,21 +29,23 @@ namespace Org.BouncyCastle.Asn1 */ public static DerVideotexString GetInstance(object obj) { - if (obj == null || obj is DerVideotexString) - { - return (DerVideotexString)obj; - } - else if (obj is IAsn1Convertible) + if (obj == null) + return null; + + if (obj is DerVideotexString derVideotexString) + return derVideotexString; + + if (obj is IAsn1Convertible asn1Convertible) { - Asn1Object asn1Object = ((IAsn1Convertible)obj).ToAsn1Object(); - if (asn1Object is DerVideotexString) - return (DerVideotexString)asn1Object; + Asn1Object asn1Object = asn1Convertible.ToAsn1Object(); + if (asn1Object is DerVideotexString converted) + return converted; } - else if (obj is byte[]) + else if (obj is byte[] bytes) { try { - return (DerVideotexString)Meta.Instance.FromByteArray((byte[])obj); + return (DerVideotexString)Meta.Instance.FromByteArray(bytes); } catch (IOException e) { |