diff options
Diffstat (limited to 'crypto/src/asn1/cmp/PKIMessages.cs')
-rw-r--r-- | crypto/src/asn1/cmp/PKIMessages.cs | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/crypto/src/asn1/cmp/PKIMessages.cs b/crypto/src/asn1/cmp/PKIMessages.cs index 0008f476a..8e2e8a1ed 100644 --- a/crypto/src/asn1/cmp/PKIMessages.cs +++ b/crypto/src/asn1/cmp/PKIMessages.cs @@ -7,37 +7,32 @@ namespace Org.BouncyCastle.Asn1.Cmp public class PkiMessages : Asn1Encodable { - private Asn1Sequence content; + private Asn1Sequence m_content; internal PkiMessages(Asn1Sequence seq) { - content = seq; + m_content = seq; } public static PkiMessages GetInstance(object obj) { - if (obj is PkiMessages) - return (PkiMessages)obj; + if (obj is PkiMessages pkiMessages) + return pkiMessages; - if (obj is Asn1Sequence) - return new PkiMessages((Asn1Sequence)obj); + if (obj is Asn1Sequence asn1Sequence) + return new PkiMessages(asn1Sequence); - throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), nameof(obj)); } public PkiMessages(params PkiMessage[] msgs) { - content = new DerSequence(msgs); + m_content = new DerSequence(msgs); } public virtual PkiMessage[] ToPkiMessageArray() { - PkiMessage[] result = new PkiMessage[content.Count]; - for (int i = 0; i != result.Length; ++i) - { - result[i] = PkiMessage.GetInstance(content[i]); - } - return result; + return m_content.MapElements(PkiMessage.GetInstance); } /** @@ -48,7 +43,7 @@ namespace Org.BouncyCastle.Asn1.Cmp */ public override Asn1Object ToAsn1Object() { - return content; + return m_content; } } } |