DataProtectionPermission.ToXml Méthode

Définition

Crée un encodage XML de l’autorisation et de son état actuel.

public:
 override System::Security::SecurityElement ^ ToXml();
public override System.Security.SecurityElement ToXml ();
override this.ToXml : unit -> System.Security.SecurityElement
Public Overrides Function ToXml () As SecurityElement

Retours

SecurityElement

Encodage XML de l’autorisation, informations d’état comprises.

Exemples

L’exemple de code suivant montre l’utilisation de la ToXml méthode. Cet exemple de code fait partie d’un exemple plus grand fourni pour la DataProtectionPermission classe.

Notes

L’exemple de code est destiné à afficher le comportement de la méthode, et non à illustrer son utilisation. En général, les méthodes des classes d’autorisation sont utilisées par l’infrastructure de sécurité; elles ne sont généralement pas utilisées dans les applications.

Console::WriteLine( "Using an XML round trip to reset the fourth "
"permission." );
sp4->FromXml( sp2->ToXml() );
rc = sp4->Equals( sp2 );
Console::WriteLine( "Does the XML round trip result equal the "
"original permission? {0}", (rc ? (String^)"Yes" : "No") );
Console.WriteLine("Using an XML round trip to reset the fourth " +
    "permission.");
sp4.FromXml(sp2.ToXml());
rc = sp4.Equals(sp2);
Console.WriteLine("Does the XML round trip result equal the " +
    "original permission? " + (rc ? "Yes" : "No"));
    Console.WriteLine("Using an XML round trip to reset the fourth " + "permission.")
    sp4.FromXml(sp2.ToXml())
    rc = sp4.Equals(sp2)
    Console.WriteLine("Does the XML round trip result equal the " + "original permission? " + IIf(rc, "Yes", "No")) 'TODO: For performance reasons this should be changed to nested IF statements

End Sub

Remarques

Utilisez la FromXml méthode pour restaurer les informations d’état à partir d’un SecurityElement.

S’applique à