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)

适用于