IsolatedStorageFilePermission.ToXml メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > IsolatedStorageFilePermission.ToXml メソッドの意味・解説 

IsolatedStorageFilePermission.ToXml メソッド

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

名前空間: System.Security.Permissions
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<ComVisibleAttribute(False)> _
Public Overrides Function
 ToXml As SecurityElement
Dim instance As IsolatedStorageFilePermission
Dim returnValue As SecurityElement

returnValue = instance.ToXml
[ComVisibleAttribute(false)] 
public override SecurityElement ToXml ()
[ComVisibleAttribute(false)] 
public:
virtual SecurityElement^ ToXml () override
/** @attribute ComVisibleAttribute(false) */ 
public SecurityElement ToXml ()
ComVisibleAttribute(false) 
public override function ToXml () : SecurityElement

戻り値
状態情報を含む、アクセス許可XML エンコーディング

解説解説

ToXml メソッドにより、IsolatedStorageFilePermission はセキュリティ目的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   
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IsolatedStorageFilePermission クラス
IsolatedStorageFilePermission メンバ
System.Security.Permissions 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からIsolatedStorageFilePermission.ToXml メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からIsolatedStorageFilePermission.ToXml メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からIsolatedStorageFilePermission.ToXml メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

IsolatedStorageFilePermission.ToXml メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



IsolatedStorageFilePermission.ToXml メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS