AsymmetricAlgorithm.ToXmlString(Boolean) Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Quando sottoposto a override in una classe derivata, crea e restituisce una rappresentazione di stringa XML dell'oggetto corrente AsymmetricAlgorithm . In caso contrario, genera un NotImplementedException.
public:
abstract System::String ^ ToXmlString(bool includePrivateParameters);
public:
virtual System::String ^ ToXmlString(bool includePrivateParameters);
public abstract string ToXmlString(bool includePrivateParameters);
public virtual string ToXmlString(bool includePrivateParameters);
abstract member ToXmlString : bool -> string
abstract member ToXmlString : bool -> string
override this.ToXmlString : bool -> string
Public MustOverride Function ToXmlString (includePrivateParameters As Boolean) As String
Public Overridable Function ToXmlString (includePrivateParameters As Boolean) As String
Parametri
- includePrivateParameters
- Boolean
true per includere parametri privati; in caso contrario, false.
Valori restituiti
Codifica di stringa XML dell'oggetto corrente AsymmetricAlgorithm .
Esempio
Nell'esempio di codice seguente viene illustrato come chiamare il ToXmlString metodo per creare una rappresentazione XML dei parametri nell'oggetto corrente AsymmetricAlgorithm . Questo esempio di codice fa parte di un esempio più ampio fornito per la AsymmetricAlgorithm classe .
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