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

Dim instance As IsolatedStorageFilePermission Dim returnValue As SecurityElement returnValue = instance.ToXml
状態情報を含む、アクセス許可の XML エンコーディング。


ToXml メソッドの使用方法を次のコード例に示します。このコード例は、IsolatedStorageFilePermission クラスのトピックで取り上げているコード例の一部分です。
Private Sub To_FromXmlDemo() Console.WriteLine(ControlChars.Lf + "To_FromXML demo.") Dim firstPermission As New IsolatedStorageFilePermission(PermissionState.Unrestricted) Console.WriteLine(("First permission: " + firstPermission.ToString())) Dim se As SecurityElement = firstPermission.ToXml() Dim secondPermission As New IsolatedStorageFilePermission(PermissionState.None) Console.WriteLine(("Second permission: " + secondPermission.ToString())) secondPermission.FromXml(se) Dim thirdPermission As IsolatedStorageFilePermission = CType(secondPermission.Intersect(firstPermission), IsolatedStorageFilePermission) Console.WriteLine(("Intersection of first permission and second permission: " + thirdPermission.ToString())) Try If False = thirdPermission.IsUnrestricted() Then Console.WriteLine("To_FromXml demo failed: The ToXml, FromXml roundtrip did not succeed.") End If Catch e As Exception Console.WriteLine("To_FromXml demo failed: An exception was thrown when checking the intersection") Console.WriteLine("of the permissions after the XML roundtrip.") Console.WriteLine(e.ToString()) Console.WriteLine(e.ToString()) End Try End Sub 'To_FromXmlDemo
private void To_FromXmlDemo() { Console.WriteLine ("\nTo_FromXML demo."); IsolatedStorageFilePermission firstPermission = new IsolatedStorageFilePermission(PermissionState.Unrestricted); Console.WriteLine ("First permission: " + firstPermission.ToString()); SecurityElement se = firstPermission.ToXml(); IsolatedStorageFilePermission secondPermission = new IsolatedStorageFilePermission(PermissionState.None); Console.WriteLine ("Second permission: " + secondPermission.ToString()); secondPermission.FromXml(se); IsolatedStorageFilePermission thirdPermission = (IsolatedStorageFilePermission)secondPermission.Intersect(firstPermission); Console.WriteLine ("Intersection of first permission and second permission: " + thirdPermission.ToString()); try { if (false == thirdPermission.IsUnrestricted()) { Console.WriteLine ("To_FromXml demo failed: The ToXml, FromXml roundtrip did not succeed."); } } catch (Exception e) { Console.WriteLine("To_FromXml demo failed: An exception was thrown when checking the intersection"); Console.WriteLine("of the permissions after the XML roundtrip."); Console.WriteLine(e.ToString()); Console.WriteLine(e.ToString()); } }
void To_FromXmlDemo() { Console::WriteLine( "\nTo_FromXML demo." ); IsolatedStorageFilePermission^ firstPermission = gcnew IsolatedStorageFilePermission( PermissionState::Unrestricted ); Console::WriteLine( "First permission: {0}", firstPermission ); SecurityElement^ se = firstPermission->ToXml(); IsolatedStorageFilePermission^ secondPermission = gcnew IsolatedStorageFilePermission( PermissionState::None ); Console::WriteLine( "Second permission: {0}", secondPermission ); secondPermission->FromXml( se ); IsolatedStorageFilePermission^ thirdPermission = dynamic_cast<IsolatedStorageFilePermission^>(secondPermission->Intersect( firstPermission )); Console::WriteLine( "Intersection of first permission and second permission: {0}", thirdPermission ); try { if ( false == thirdPermission->IsUnrestricted() ) { Console::WriteLine( "To_FromXml demo failed: The ToXml, FromXml roundtrip did not succeed." ); } } catch ( Exception^ e ) { Console::WriteLine( "To_FromXml demo failed: An exception was thrown when checking the intersection" ); Console::WriteLine( "of the permissions after the XML roundtrip." ); Console::WriteLine( e ); Console::WriteLine( e ); } }
private void To_FromXmlDemo() { Console.WriteLine("\nTo_FromXML demo."); IsolatedStorageFilePermission firstPermission = new IsolatedStorageFilePermission(PermissionState.Unrestricted); Console.WriteLine(("First permission: " + firstPermission.ToString())); SecurityElement se = firstPermission.ToXml(); IsolatedStorageFilePermission secondPermission = new IsolatedStorageFilePermission(PermissionState.None); Console.WriteLine(("Second permission: " + secondPermission.ToString())); secondPermission.FromXml(se); IsolatedStorageFilePermission thirdPermission = ((IsolatedStorageFilePermission) (secondPermission.Intersect(firstPermission))); Console.WriteLine(("Intersection of first permission and " + "second permission: " + thirdPermission.ToString())); try { if (false == thirdPermission.IsUnrestricted()) { Console.WriteLine("To_FromXml demo failed: The ToXml, " + "FromXml roundtrip did not succeed."); } } catch (System.Exception e) { Console.WriteLine("To_FromXml demo failed: An exception " + "was thrown when checking the intersection"); Console.WriteLine("of the permissions after the XML roundtrip."); Console.WriteLine(e.ToString()); Console.WriteLine(e.ToString()); } } //To_FromXmlDemo

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に収録されているすべての辞書からIsolatedStorageFilePermission.ToXml メソッドを検索する場合は、下記のリンクをクリックしてください。

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