CodeAccessPermission.ToXml メソッド
アセンブリ: mscorlib (mscorlib.dll 内)

Dim instance As CodeAccessPermission Dim returnValue As SecurityElement returnValue = instance.ToXml
セキュリティ オブジェクトとそのすべての状態情報を含む XML エンコーディング。

セキュリティ オブジェクトを拡張するカスタム コードでは、ToXml メソッドと FromXml メソッドを実装し、オブジェクトをセキュリティのエンコードに対応させる必要があります。
継承時の注意 派生クラスでこのメソッドをオーバーライドする必要があります。
ToXml メソッドをオーバーライドする方法を次のコード例に示します。このコード例は、CodeAccessPermission クラスのトピックで取り上げているコード例の一部分です。
Public Overrides Function ToXml() As SecurityElement ' Use the SecurityElement class to encode the permission to XML. Dim esd As New SecurityElement("IPermission") Dim name As String = GetType(NameIdPermission).AssemblyQualifiedName esd.AddAttribute("class", name) esd.AddAttribute("version", "1.0") ' The following code for unrestricted permission is only included as an example for ' permissions that allow the unrestricted state. It is of no value for this permission. If m_Unrestricted Then esd.AddAttribute("Unrestricted", True.ToString()) End If If Not (m_Name Is Nothing) Then esd.AddAttribute("Name", m_Name) End If Return esd End Function 'ToXml
public override SecurityElement ToXml() { // Use the SecurityElement class to encode the permission to XML. SecurityElement esd = new SecurityElement("IPermission"); String name = typeof( NameIdPermission).AssemblyQualifiedName; esd.AddAttribute("class", name); esd.AddAttribute("version", "1.0"); // The following code for unrestricted permission is only included as an example for // permissions that allow the unrestricted state. It is of no value for this permission. if (m_Unrestricted) { esd.AddAttribute("Unrestricted", true.ToString()); } if (m_Name != null) esd.AddAttribute( "Name", m_Name ); return esd; }
public: virtual SecurityElement^ ToXml() override { // Use the SecurityElement class to encode the permission to XML. SecurityElement^ esd = gcnew SecurityElement( "IPermission" ); String^ name = NameIdPermission::typeid->AssemblyQualifiedName; esd->AddAttribute( "class", name ); esd->AddAttribute( "version", "1.0" ); // The following code for unrestricted permission is only included as an example for // permissions that allow the unrestricted state. It is of no value for this permission. if ( m_Unrestricted ) { esd->AddAttribute( "Unrestricted", true.ToString() ); } if ( m_Name != nullptr ) { esd->AddAttribute( "Name", m_Name ); } return esd; }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からCodeAccessPermission.ToXml メソッドを検索する場合は、下記のリンクをクリックしてください。

- CodeAccessPermission.ToXml メソッドのページへのリンク