diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-07-14 15:07:49 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-07-14 15:07:49 +0700 |
commit | dc8b86c13c769e6de9a5c38e3c67921b034a2394 (patch) | |
tree | b79eb20bc7ed797e7624ccb5ceb8293ed429751e /crypto/src/asn1/x509/Holder.cs | |
parent | Refactor using MapElements (diff) | |
download | BouncyCastle.NET-ed25519-dc8b86c13c769e6de9a5c38e3c67921b034a2394.tar.xz |
Refactoring in Asn1
Diffstat (limited to 'crypto/src/asn1/x509/Holder.cs')
-rw-r--r-- | crypto/src/asn1/x509/Holder.cs | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/crypto/src/asn1/x509/Holder.cs b/crypto/src/asn1/x509/Holder.cs index 90df75a0f..3da57f70f 100644 --- a/crypto/src/asn1/x509/Holder.cs +++ b/crypto/src/asn1/x509/Holder.cs @@ -42,33 +42,26 @@ namespace Org.BouncyCastle.Asn1.X509 internal readonly ObjectDigestInfo objectDigestInfo; private readonly int version; - public static Holder GetInstance( - object obj) + public static Holder GetInstance(object obj) { - if (obj is Holder) - { - return (Holder) obj; - } + if (obj is Holder holder) + return holder; - if (obj is Asn1Sequence) - { - return new Holder((Asn1Sequence) obj); - } + if (obj is Asn1Sequence sequence) + return new Holder(sequence); - if (obj is Asn1TaggedObject) - { - return new Holder((Asn1TaggedObject) obj); - } + if (obj is Asn1TaggedObject taggedObject) + return new Holder(taggedObject); throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); - } + } - /** + /** * Constructor for a holder for an v1 attribute certificate. * * @param tagObj The ASN.1 tagged holder object. */ - public Holder( + public Holder( Asn1TaggedObject tagObj) { switch (tagObj.TagNo) |