Share via


DataProtectionPermission.ToXml メソッド

定義

アクセス許可とその現在の状態の XML エンコードを作成します。

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

戻り値

状態情報を含む、アクセス許可の XML エンコード。

次のコード例は、 メソッドの使用方法を ToXml 示しています。 このコード例は、DataProtectionPermission クラスのために提供されている大規模な例の一部です。

注意

このコード例は、 メソッドの動作を示すことを目的とするものであり、その使用方法を示すものではありません。 一般に、アクセス許可クラスのメソッドはセキュリティ インフラストラクチャによって使用されます。通常、アプリケーションでは使用されません。

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

注釈

から FromXml 状態情報を復元するには、 メソッドを SecurityElement使用します。

適用対象