AsymmetricAlgorithm.ToXmlString(Boolean) メソッド

定義

派生クラスでオーバーライドされた場合は、現在の AsymmetricAlgorithm オブジェクトの XML 文字列形式を作成して返します。When overridden in a derived class, creates and returns an XML string representation of the current AsymmetricAlgorithm object. それ以外の場合は、NotImplementedException をスローします。Otherwise, throws a NotImplementedException.

public:
 abstract System::String ^ ToXmlString(bool includePrivateParameters);
public abstract string ToXmlString (bool includePrivateParameters);
abstract member ToXmlString : bool -> string
Public MustOverride Function ToXmlString (includePrivateParameters As Boolean) As String

パラメーター

includePrivateParameters
Boolean

プライベート パラメーターを含める場合は true。それ以外の場合は falsetrue to include private parameters; otherwise, false.

戻り値

現在の AsymmetricAlgorithm オブジェクトの XML 文字列エンコーディング。An XML string encoding of the current AsymmetricAlgorithm object.

次のコード例は、ToXmlString メソッドを呼び出して、現在の AsymmetricAlgorithm オブジェクトのパラメーターの XML 表現を作成する方法を示しています。The following code example demonstrates how to call the ToXmlString method to create an XML representation of the parameters in the current AsymmetricAlgorithm object. このコード例は、AsymmetricAlgorithm クラス用に用意されている大規模な例の一部です。This code example is part of a larger example provided for the AsymmetricAlgorithm class.

public:
    virtual String^ ToXmlString(bool includePrivateParameters) override
    {
        String^ keyContainerName = "";
        String^ keyNumber = "";
        String^ providerName = "";
        String^ providerType = "";

        if (cryptoServiceParameters != nullptr)
        {
            keyContainerName = 
                cryptoServiceParameters->KeyContainerName;
            keyNumber = cryptoServiceParameters->KeyNumber.ToString();
            providerName = cryptoServiceParameters->ProviderName;
            providerType = 
                cryptoServiceParameters->ProviderType.ToString();
        }

        StringBuilder^ sb = gcnew StringBuilder();
        sb->Append("<CustomCryptoKeyValue>");

        sb->Append("<KeyContainerName>");
        sb->Append(keyContainerName);
        sb->Append("</KeyContainerName>");

        sb->Append("<KeyNumber>");
        sb->Append(keyNumber);
        sb->Append("</KeyNumber>");

        sb->Append("<ProviderName>");
        sb->Append(providerName);
        sb->Append("</ProviderName>");

        sb->Append("<ProviderType>");
        sb->Append(providerType);
        sb->Append("</ProviderType>");

        sb->Append("</CustomCryptoKeyValue>");
        return(sb->ToString());
    }
public override string ToXmlString(bool includePrivateParameters)
{
    string keyContainerName = "";
    string keyNumber = "";
    string providerName = "";
    string providerType = "";

    if (cspParameters != null)
    {
        keyContainerName = cspParameters.KeyContainerName;
        keyNumber = cspParameters.KeyNumber.ToString();
        providerName = cspParameters.ProviderName;
        providerType = cspParameters.ProviderType.ToString();
    }

    StringBuilder sb = new StringBuilder();
    sb.Append("<CustomCryptoKeyValue>");

    sb.Append("<KeyContainerName>");
    sb.Append(keyContainerName);
    sb.Append("</KeyContainerName>");

    sb.Append("<KeyNumber>");
    sb.Append(keyNumber);
    sb.Append("</KeyNumber>");

    sb.Append("<ProviderName>");
    sb.Append(providerName);
    sb.Append("</ProviderName>");

    sb.Append("<ProviderType>");
    sb.Append(providerType);
    sb.Append("</ProviderType>");

    sb.Append("</CustomCryptoKeyValue>");
    return(sb.ToString());
}
Public Overrides Function ToXmlString( _
    ByVal includePrivateParameters As Boolean) As String

    Dim keyContainerName As String = ""
    Dim keyNumber As String = ""
    Dim providerName As String = ""
    Dim providerType As String = ""

    If Not cspParameters Is Nothing Then
        keyContainerName = cspParameters.KeyContainerName
        keyNumber = cspParameters.KeyNumber.ToString()
        providerName = cspParameters.ProviderName
        providerType = cspParameters.ProviderType.ToString()
    End If

    Dim xmlBuilder As New StringBuilder
    xmlBuilder.Append("<CustomCryptoKeyValue>")

    xmlBuilder.Append("<KeyContainerName>")
    xmlBuilder.Append(keyContainerName)
    xmlBuilder.Append("</KeyContainerName>")

    xmlBuilder.Append("<KeyNumber>")
    xmlBuilder.Append(keyNumber)
    xmlBuilder.Append("</KeyNumber>")

    xmlBuilder.Append("<ProviderName>")
    xmlBuilder.Append(providerName)
    xmlBuilder.Append("</ProviderName>")

    xmlBuilder.Append("<ProviderType>")
    xmlBuilder.Append(providerType)
    xmlBuilder.Append("</ProviderType>")

    xmlBuilder.Append("</CustomCryptoKeyValue>")
    Return (xmlBuilder.ToString())
End Function

適用対象

こちらもご覧ください