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

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

AttributeCollection.GetEnumerator メソッド

このコレクション列挙子を取得します

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

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

returnValue = instance.GetEnumerator

戻り値
IEnumerator 型の列挙子。

使用例使用例

button1属性列挙子を取得するコード例次に示します。この例では、列挙子を使用してコレクション内の属性の名前を出力します。この例は、フォーム上に button1textBox1作成されていることを前提としています。

Private Sub MyEnumerator
    ' Creates a new collection and assigns it the attributes for button1.
    Dim attributes As AttributeCollection
    attributes = TypeDescriptor.GetAttributes(button1)

    ' Creates an enumerator for the collection.
    Dim ie As System.Collections.IEnumerator
 = attributes.GetEnumerator

    ' Prints the type of each attribute in the collection.
    Dim myAttribute As Object
    Do While ie.MoveNext
        myAttribute = ie.Current
        textBox1.Text = textBox1.Text & myAttribute.toString & ControlChars.crlf
    Loop
End Sub
private void MyEnumerator() {
    // Creates a new collection and assigns it the attributes for button1.
    AttributeCollection attributes;
    attributes = TypeDescriptor.GetAttributes(button1);
 
    // Creates an enumerator for the collection.
    System.Collections.IEnumerator ie = attributes.GetEnumerator();
 
    // Prints the type of each attribute in the collection.
    Object myAttribute;
    while(ie.MoveNext()==true) {
       myAttribute = ie.Current;
       textBox1.Text += myAttribute.ToString();
       textBox1.Text += '\n';
    }
 }

private:
   void MyEnumerator()
   {
      // Creates a new collection and assigns it the attributes for
 button1.
      AttributeCollection^ attributes;
      attributes = TypeDescriptor::GetAttributes( button1 );
      
      // Creates an enumerator for the collection.
      System::Collections::IEnumerator^ ie = attributes->GetEnumerator();
      
      // Prints the type of each attribute in the collection.
      Object^ myAttribute;
      System::Text::StringBuilder^ text = gcnew System::Text::StringBuilder;
      while ( ie->MoveNext() == true )
      {
         myAttribute = ie->Current;
         text->Append( myAttribute );
         text->Append( '\n' );
      }
      textBox1->Text = text->ToString();
   }
private void MyEnumerator()
{
    // Creates a new collection and assigns it the attributes for button1.
    AttributeCollection attributes;
    attributes = TypeDescriptor.GetAttributes(button1);

    // Creates an enumerator for the collection.
    System.Collections.IEnumerator ie = attributes.GetEnumerator();

    // Prints the type of each attribute in the collection.
    Object myAttribute;
    while ((ie.MoveNext() == true)) {
        myAttribute = ie.get_Current();
        textBox1.set_Text(textBox1.get_Text() + myAttribute.ToString());
        textBox1.set_Text(textBox1.get_Text() + '\n');
    }
} //MyEnumerator
private function MyEnumerator() {
    // Creates a new collection and assigns it the attributes for button1.
    var attributes : AttributeCollection;
    attributes = TypeDescriptor.GetAttributes(button1);
 
    // Creates an enumerator for the collection.
    var ie : System.Collections.IEnumerator  = attributes.GetEnumerator();
 
    // Prints the type of each attribute in the collection.
    var myAttribute;
    while(ie.MoveNext()==true) {
       myAttribute = ie.Current;
       textBox1.Text += myAttribute.ToString();
       textBox1.Text += '\n';
    }
 }

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
AttributeCollection クラス
AttributeCollection メンバ
System.ComponentModel 名前空間
Attribute
IEnumerator


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2024 GRAS Group, Inc.RSS