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

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

GacIdentityPermission.FromXml メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

XML エンコーディングからアクセス許可作成します

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

Public Overrides Sub FromXml
 ( _
    securityElement As SecurityElement _
)
Dim instance As GacIdentityPermission
Dim securityElement As SecurityElement

instance.FromXml(securityElement)
public override void FromXml (
    SecurityElement securityElement
)
public:
virtual void FromXml (
    SecurityElement^ securityElement
) override
public void FromXml (
    SecurityElement securityElement
)
public override function FromXml (
    securityElement : SecurityElement
)

パラメータ

securityElement

アクセス許可作成使用する XML エンコーディング格納している SecurityElement。

例外例外
例外種類条件

ArgumentNullException

securityElementnull 参照 (Visual Basic では Nothing) です。

ArgumentException

securityElement有効なアクセス許可要素ではありません。

または

securityElementバージョン番号無効です。

解説解説

FromXml メソッドは、SecurityElement オブジェクト定義される XML エンコーディングから GacIdentityPermission を作成します。ToXml メソッド使用してステータス情報を含む GacIdentityPermissionXMLエンコードます。

使用例使用例

FromXml メソッド使用するコード例次に示します。このコード例は、GacIdentityPermission クラストピック取り上げているコード例一部分です。

' ToXml creates an XML encoding of the permission and its current state;
 FromXml reconstructs a 
' permission with the specified state from the XML encoding. 
Private Function ToFromXmlDemo() As
 Boolean
    Dim Gac1 As New GacIdentityPermission
    Dim Gac2 As New GacIdentityPermission
    Console.WriteLine("**************************************************************************")
    Try
        Gac2 = New GacIdentityPermission(PermissionState.None)
        Gac2.FromXml(Gac1.ToXml())
        Dim result As Boolean
 = Gac2.Equals(Gac1)
        If Gac2.IsSubsetOf(Gac1) AndAlso Gac1.IsSubsetOf(Gac2)
 Then
            Console.WriteLine(("Result of ToFromXml = "
 & Gac2.ToString()))
        Else
            Console.WriteLine(Gac2.ToString())
            Console.WriteLine(Gac1.ToString())
            Return False
        End If
    Catch e As Exception
        Console.WriteLine(("ToFromXml failed. " &
 e.ToString()))
        Return False
    End Try

    Return True
End Function 'ToFromXmlDemo

// ToXml creates an XML encoding of the permission and its current state;
 FromXml reconstructs a
// permission with the specified state from the XML encoding.
private bool ToFromXmlDemo()
{
    GacIdentityPermission Gac1 = new GacIdentityPermission();
    GacIdentityPermission Gac2 = new GacIdentityPermission();
    Console.WriteLine("**************************************************************************");
    try
    {
        Gac2 = new GacIdentityPermission(PermissionState.None);
        Gac2.FromXml(Gac1.ToXml());
        bool result = Gac2.Equals(Gac1);
        if (Gac2.IsSubsetOf(Gac1) && Gac1.IsSubsetOf(Gac2))
        {
            Console.WriteLine("Result of ToFromXml = " + Gac2.ToString());
        }
        else
        {
            Console.WriteLine(Gac2.ToString());
            Console.WriteLine(Gac1.ToString());
            return false;
        }
    }
    catch (Exception e)
    {
        Console.WriteLine("ToFromXml failed. " + e);
        return false;
    }

    return true;

}
   // ToXml creates an XML encoding of the permission and its current state;
 FromXml reconstructs a 
   // permission with the specified state from the XML encoding. 
   bool ToFromXmlDemo()
   {
      GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission;
      GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission;
      Console::WriteLine( "**************************************************************************"
 );
      try
      {
         Gac2 = gcnew GacIdentityPermission( PermissionState::None );
         Gac2->FromXml( Gac1->ToXml() );
         bool result = Gac2->Equals( Gac1 );
         if ( Gac2->IsSubsetOf( Gac1 ) && Gac1->IsSubsetOf(
 Gac2 ) )
         {
            Console::WriteLine( "Result of ToFromXml = {0}", Gac2 );
         }
         else
         {
            Console::WriteLine( Gac2 );
            Console::WriteLine( Gac1 );
            return false;
         }
      }
      catch ( Exception^ e ) 
      {
         Console::WriteLine( "ToFromXml failed. {0}", e );
         return false;
      }

      return true;
   }


public:

// ToXml creates an XML encoding of the permission and its current state;
 
// FromXml reconstructs a permission with the specified state from the
 
// XML encoding.
private boolean ToFromXmlDemo()
{
    GacIdentityPermission gac1 = new GacIdentityPermission();
    GacIdentityPermission gac2 = new GacIdentityPermission();
    Console.WriteLine("***************************************" 
        + "***********************************");
    
    try {
        gac2 = new GacIdentityPermission(PermissionState.None);
        gac2.FromXml(gac1.ToXml());

        boolean result = gac2.Equals(gac1);

        if (gac2.IsSubsetOf(gac1) && gac1.IsSubsetOf(gac2))
 {
            Console.WriteLine(("Result of ToFromXml = " + gac2.ToString()));
        }
        else {
            Console.WriteLine(gac2.ToString());
            Console.WriteLine(gac1.ToString());
            return false;
        }
    }
    catch (System.Exception e) {
        Console.WriteLine(("ToFromXml failed. " + e));
        return false;
    }
    return true;
} //ToFromXmlDemo    
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
GacIdentityPermission クラス
GacIdentityPermission メンバ
System.Security.Permissions 名前空間



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2024 GRAS Group, Inc.RSS