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

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

ConfigurationPropertyCollection.GetEnumerator メソッド

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

コレクション適用する IEnumerator オブジェクト取得します

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

Public Function GetEnumerator As
 IEnumerator
Dim instance As ConfigurationPropertyCollection
Dim returnValue As IEnumerator

returnValue = instance.GetEnumerator

戻り値
コレクション適用する IEnumerator オブジェクト

使用例使用例

GetEnumerator メソッド使用する方法の例を次に示します

' Get the property collection enumerator.
Public Function GetCollectionEnumerator() As
 IEnumerator
   Return Properties.GetEnumerator()
End Function 'GetCollectionEnumerator
// Get the property collection enumerator.
public IEnumerator GetCollectionEnumerator()
{
    return (Properties.GetEnumerator());
}

上記メソッド呼び出してコレクション内の ConfigurationProperty オブジェクト列挙する方法の例を次に示します

' Enumerate the collection elements.
Shared Sub EnumerateCollectionElements()
   Try
      
      Dim customSection As CustomSection
      
         ' Get the current configuration file.
         Dim config As System.Configuration.Configuration
 = _
         ConfigurationManager.OpenExeConfiguration( _
         ConfigurationUserLevel.None)

         ' Get the custom section.
         customSection = _
         config.GetSection("CustomSection")
      
         Dim propEnum As IEnumerator = _
         customSection.GetCollectionEnumerator()
      
      Dim i As Integer =
 0
      While propEnum.MoveNext()
         If i = 0 Then
                 Console.WriteLine( _
                 "Property {0} is {1}", i.ToString(),
 _
                 _Properties("fileName").Name)
         End If
         
         If i = 1 Then
                 Console.WriteLine( _
                 "Property {0} is {1}", i.ToString(),
 _
                 _Properties("alias").Name)
         End If
         i += 1
      End While
   
   Catch err As ConfigurationErrorsException
      Console.WriteLine(err.ToString())
   End Try
End Sub 'EnumerateCollectionElements
 
// Enumerate the collection elements.
static void EnumerateCollectionElements()
{
    try
    {

        CustomSection customSection;

        // Get the current configuration file.
        System.Configuration.Configuration config =
                ConfigurationManager.OpenExeConfiguration(
                ConfigurationUserLevel.None);

        customSection =
            config.GetSection("CustomSection") as CustomSection;

        IEnumerator propEnum = 
            customSection.GetCollectionEnumerator();

        int i = 0;
        while (propEnum.MoveNext())
        {
            if (i == 0)
               Console.WriteLine(
                "Property {0} is {1}", i.ToString(), 
                _Properties["fileName"].Name);

            if (i == 1)
                Console.WriteLine(
                "Property {0} is {1}", i.ToString(),
                _Properties["alias"].Name);
            i += 1;
        }
        
    }
    catch (ConfigurationErrorsException err)
    {
        Console.WriteLine(err.ToString());
    }

}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ConfigurationPropertyCollection クラス
ConfigurationPropertyCollection メンバ
System.Configuration 名前空間
ConfigurationProperty クラス
ConfigurationSection
ElementInformation
ConfigurationElementCollection クラス
ConfigurationElementCollectionType 列挙
ConfigurationElement クラス
ConfigurationSection


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS