共用方式為


PermissionSet.ToXml 方法

定義

建立安全物件及其目前狀態的 XML 編碼方式。

public:
 virtual System::Security::SecurityElement ^ ToXml();
public virtual System.Security.SecurityElement? ToXml ();
public virtual System.Security.SecurityElement ToXml ();
abstract member ToXml : unit -> System.Security.SecurityElement
override this.ToXml : unit -> System.Security.SecurityElement
Public Overridable Function ToXml () As SecurityElement

傳回

安全物件的 XML 編碼方式,包含所有狀態資訊。

實作

範例

下列程式代碼範例顯示 方法的使用 ToXml 方式。 此程式代碼範例是針對 類別提供的較大範例的 PermissionSet 一部分。

// Display result of ToXml and FromXml operations.
PermissionSet^ ps6 = gcnew PermissionSet( PermissionState::None );
ps6->FromXml( ps5->ToXml() );
Console::WriteLine( "Result of ToFromXml = {0}\n", ps6 );
// Display result of ToXml and FromXml operations.
PermissionSet ps6 = new PermissionSet(PermissionState.None);
ps6.FromXml(ps5.ToXml());
Console.WriteLine("Result of ToFromXml = " + ps6.ToString() + "\n");
' Display result of ToXml and FromXml operations.
Dim ps6 As New PermissionSet(PermissionState.None)
ps6.FromXml(ps5.ToXml())
Console.WriteLine("Result of ToFromXml = " & ps6.ToString() & ControlChars.Lf)

適用於