DataProtectionPermission.ToXml Metoda

Definice

Vytvoří kódování XML oprávnění a jeho aktuální stav.

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

Návraty

SecurityElement

Kódování XML oprávnění, včetně informací o stavu.

Příklady

Následující příklad kódu ukazuje použití ToXml metody. Tento příklad kódu je součástí většího příkladu poskytnutého DataProtectionPermission pro třídu.

Poznámka

Příklad kódu je určen k zobrazení chování metody, nikoli k předvedení jejího použití. Obecně platí, že metody tříd oprávnění jsou používány infrastrukturou zabezpečení; obvykle se nepoužívají v aplikacích.

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

Poznámky

FromXml Pomocí metody obnovte informace o stavu z objektu SecurityElement.

Platí pro