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

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

DnsPermission.ToXml メソッド

DnsPermission インスタンスとその現在の状態を表す XML エンコーディング作成します

名前空間: System.Net
アセンブリ: System (system.dll 内)
構文構文

Public Overrides Function
 ToXml As SecurityElement
Dim instance As DnsPermission
Dim returnValue As SecurityElement

returnValue = instance.ToXml
public override SecurityElement ToXml ()
public:
virtual SecurityElement^ ToXml () override
public SecurityElement ToXml ()
public override function ToXml () : SecurityElement

戻り値
ステータス情報を含むセキュリティ オブジェクトXMLエンコードされた表現格納している SecurityElement インスタンス

解説解説
使用例使用例

DnsPermission インスタンスXML エンコーディング作成する例を次に示します

Public Sub useDns()
    ' Create a DnsPermission instance.
    Dim permission As New
 DnsPermission(PermissionState.Unrestricted)
    
    ' Check for permission.
    permission.Demand()
    ' Create a SecurityElement object to hold XML encoding of the DnsPermission
 instance.
    Dim securityElementObj As SecurityElement
 = permission.ToXml()
    Console.WriteLine("Tag, Attributes and Values of
 'DnsPermission' instance :")
    Console.WriteLine((ControlChars.Cr + ControlChars.Tab + "Tag
 :" + securityElementObj.Tag))
    ' Print the attributes and values.
    PrintKeysAndValues(securityElementObj.Attributes)
End Sub 'useDns

Private Sub PrintKeysAndValues(myList As
 Hashtable)
    ' Get the enumerator that can iterate through the hash table.
    Dim myEnumerator As IDictionaryEnumerator
 = myList.GetEnumerator()
    Console.WriteLine(ControlChars.Cr + ControlChars.Tab + "-KEY-"
 + ControlChars.Tab + "-VALUE-")
    While myEnumerator.MoveNext()
        Console.WriteLine(ControlChars.Tab + "{0}:"
 + ControlChars.Tab + "{1}", myEnumerator.Key, myEnumerator.Value)
    End While
    Console.WriteLine()
End Sub 'PrintKeysAndValues
public void useDns() {

   // Create a DnsPermission instance.
   DnsPermission permission = new DnsPermission(PermissionState.Unrestricted);

   // Check for permission.
   permission.Demand();
   // Create a SecurityElement object to hold XML encoding of the DnsPermission
 instance.
   SecurityElement securityElementObj = permission.ToXml();    
   Console.WriteLine("Tag, Attributes and Values of 'DnsPermission' instance
 :");
   Console.WriteLine("\n\tTag :" + securityElementObj.Tag);
   // Print the attributes and values.
   PrintKeysAndValues(securityElementObj.Attributes);
}

private void PrintKeysAndValues(Hashtable myList)
 {
   // Get the enumerator that can iterate through the hash table.
   IDictionaryEnumerator myEnumerator = myList.GetEnumerator();
   Console.WriteLine("\n\t-KEY-\t-VALUE-");
   while (myEnumerator.MoveNext())
      Console.WriteLine("\t{0}:\t{1}", myEnumerator.Key, myEnumerator.Value);
   Console.WriteLine();
}
public:
   void useDns()
   {
      // Create a DnsPermission instance.
      DnsPermission^ permission = gcnew DnsPermission( PermissionState::Unrestricted
 );
      
      // Check for permission.
      permission->Demand();
      // Create a SecurityElement Object* to hold XML encoding of the
 DnsPermission instance.
      SecurityElement^ securityElementObj = permission->ToXml();
      Console::WriteLine( "Tag, Attributes and Values of 'DnsPermission' instance
 :" );
      Console::WriteLine( "\n\tTag : {0}", securityElementObj->Tag );
      // Print the attributes and values.
      PrintKeysAndValues( securityElementObj->Attributes );
   }

private:
   void PrintKeysAndValues( Hashtable^ myList )
   {
      // Get the enumerator that can iterate through the hash table.
      IDictionaryEnumerator^ myEnumerator = myList->GetEnumerator();
      Console::WriteLine( "\n\t-KEY-\t-VALUE-" );
      while ( myEnumerator->MoveNext() )
      {
         Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value
 );
      }
      Console::WriteLine();
   }
public void UseDns()
{
    // Create a DnsPermission instance.
    DnsPermission permission = new DnsPermission(PermissionState.
        Unrestricted);

    // Check for permission.
    permission.Demand();

    // Create a SecurityElement object to hold XML encoding of the
    // DnsPermission instance.
    SecurityElement securityElementObj = permission.ToXml();
    Console.WriteLine("Tag, Attributes and Values of 'DnsPermission' "
        + "instance :");
    Console.WriteLine("\n\tTag :" + securityElementObj.get_Tag());

    // Print the attributes and values.
    PrintKeysAndValues(securityElementObj.get_Attributes());
} //UseDns

private void PrintKeysAndValues(Hashtable myList)
{
    // Get the enumerator that can iterate through the hash table.
    IDictionaryEnumerator myEnumerator = myList.GetEnumerator();
    Console.WriteLine("\n\t-KEY-\t-VALUE-");
    while (myEnumerator.MoveNext()) {
        Console.WriteLine("\t{0}:\t{1}", myEnumerator.get_Key(), 
            myEnumerator.get_Value());
    }
    Console.WriteLine();
} //PrintKeysAndValues
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2026 GRAS Group, Inc.RSS