PropertyDescriptorCollection クラス

定義

PropertyDescriptor オブジェクトのコレクションを表します。

public ref class PropertyDescriptorCollection : System::Collections::IDictionary, System::Collections::IList
public class PropertyDescriptorCollection : System.Collections.IDictionary, System.Collections.IList
type PropertyDescriptorCollection = class
    interface ICollection
    interface IEnumerable
    interface IDictionary
    interface IList
type PropertyDescriptorCollection = class
    interface IList
    interface IDictionary
    interface ICollection
    interface IEnumerable
type PropertyDescriptorCollection = class
    interface ICollection
    interface IEnumerable
    interface IList
    interface IDictionary
Public Class PropertyDescriptorCollection
Implements IDictionary, IList
継承
PropertyDescriptorCollection
実装

次のコード例では、 の プロパティを使用して新しい PropertyDescriptorCollection を作成します button1。 フォームで がインスタンス化されている必要 button1 があります。

PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 );
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1);
Dim properties As PropertyDescriptorCollection = TypeDescriptor.GetProperties(button1)

次の使用例は、テキスト ボックス内のボタンにすべてのプロパティを出力します。 フォームで と textBox1 がインスタンス化されている必要button1があります。

private:
   void MyPropertyCollection()
   {
      // Creates a new collection and assign it the properties for button1.
      PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 );
      
      // Displays each property in the collection in a text box.
      for each ( PropertyDescriptor^ myProperty in properties )
      {
         textBox1->Text = String::Concat( textBox1->Text, myProperty->Name, "\n" );
      }
   }
private void MyPropertyCollection() {
    // Creates a new collection and assign it the properties for button1.
    PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1);
 
    // Displays each property in the collection in a text box.
    foreach (PropertyDescriptor myProperty in properties)
       textBox1.Text += myProperty.Name + '\n';
 }
Private Sub MyPropertyCollection()
    ' Creates a new collection and assign it the properties for button1.
    Dim properties As PropertyDescriptorCollection = TypeDescriptor.GetProperties(button1)
    
    ' Displays each property in the collection in a text box.
    Dim myProperty As PropertyDescriptor
    For Each myProperty In  properties
        textBox1.Text &= myProperty.Name & ControlChars.Cr
    Next myProperty
End Sub

注釈

PropertyDescriptorCollection は読み取り専用です。プロパティを追加または削除するメソッドは実装されません。 これらのメソッドを実装するには、このクラスから継承する必要があります。

クラスで使用できるプロパティを PropertyDescriptorCollection 使用すると、その内容についてコレクションに対してクエリを実行できます。 コレクション内の要素の数を確認するには、Count プロパティを使用します。 Item[]インデックス番号または名前で特定のプロパティを取得するには、 プロパティを使用します。

プロパティに加えて、 メソッドを Find 使用して、指定した名前のプロパティの説明をコレクションから取得できます。

コンストラクター

PropertyDescriptorCollection(PropertyDescriptor[])

PropertyDescriptorCollection クラスの新しいインスタンスを初期化します。

PropertyDescriptorCollection(PropertyDescriptor[], Boolean)

オプションで読み取り専用にできる PropertyDescriptorCollection クラスの新しい空のインスタンスを初期化します。

フィールド

Empty

項目のない新しいコレクションを作成する代わりに使用できる、空のコレクションを指定します。 static フィールドは読み取り専用です。

プロパティ

Count

コレクション内のプロパティ記述子の数を取得します。

Item[Int32]

指定したインデックス番号にある PropertyDescriptor を取得または設定します。

Item[String]

指定した名前の PropertyDescriptor を取得または設定します。

メソッド

Add(PropertyDescriptor)

指定された PropertyDescriptor をコレクションに追加します。

Clear()

コレクションからすべての PropertyDescriptor オブジェクトを削除します。

Contains(PropertyDescriptor)

指定した PropertyDescriptor がコレクションに格納されているかどうかを示す値を返します。

CopyTo(Array, Int32)

指定したインデックス番号を開始位置として、配列にコレクション全体をコピーします。

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
Find(String, Boolean)

大文字と小文字の違いを無視するかどうかを示すブール値を使用して、指定した名前の PropertyDescriptor を返します。

GetEnumerator()

クラスの列挙子を返します。

GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IndexOf(PropertyDescriptor)

指定した PropertyDescriptor のインデックスを返します。

Insert(Int32, PropertyDescriptor)

コレクション内の指定したインデックス番号の位置に PropertyDescriptor を追加します。

InternalSort(IComparer)

指定した IComparer を使用して、コレクションのメンバーを並べ替えます。

InternalSort(String[])

このコレクションのメンバーを並べ替えます。 指定した順序が最初に適用され、次にコレクションの既定の並べ替え順序が適用されます。既定の並べ替え順序は、通常はアルファベット順です。

MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
Remove(PropertyDescriptor)

指定された PropertyDescriptor をコレクションから削除します。

RemoveAt(Int32)

指定したインデックス位置にある PropertyDescriptor をコレクションから削除します。

Sort()

このコレクションの既定の並べ替えを使用して、このコレクションのメンバーを並べ替えます。既定の並べ替えは、通常はアルファベット順です。

Sort(IComparer)

指定した IComparer を使用して、コレクションのメンバーを並べ替えます。

Sort(String[])

このコレクションのメンバーを並べ替えます。 指定した順序が最初に適用され、次にコレクションの既定の並べ替え順序が適用されます。既定の並べ替え順序は、通常はアルファベット順です。

Sort(String[], IComparer)

このコレクションのメンバーを並べ替えます。 指定した順序が最初に適用され、指定した IComparer を使用した並べ替えが次に行われます。

ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

ICollection.Count

コレクションに格納されている要素の数を取得します。

ICollection.IsSynchronized

コレクションへのアクセスが同期されている (スレッド セーフである) かどうかを示す値を取得します。

ICollection.SyncRoot

コレクションへのアクセスを同期するために使用できるオブジェクトを取得します。

IDictionary.Add(Object, Object)

指定したキーおよび値を持つ要素を IDictionary オブジェクトに追加します。

IDictionary.Clear()

IDictionary からすべての要素を削除します。

IDictionary.Contains(Object)

指定したキーの要素が IDictionary に格納されているかどうかを確認します。

IDictionary.GetEnumerator()

クラスの列挙子を返します。

IDictionary.IsFixedSize

IDictionary が固定サイズかどうかを示す値を取得します。

IDictionary.IsReadOnly

IDictionary が読み取り専用かどうかを示す値を取得します。

IDictionary.Item[Object]

指定したキーを持つ要素を取得または設定します。

IDictionary.Keys

ICollection のキーを保持している IDictionary を取得します。

IDictionary.Remove(Object)

指定したキーを持つ要素を IDictionary から削除します。

IDictionary.Values

ICollection 内の値を格納している IDictionary を取得します。

IEnumerable.GetEnumerator()

IEnumeratorIDictionary を返します。

IList.Add(Object)

IList に項目を追加します。

IList.Clear()

コレクションからすべての項目を削除します。

IList.Contains(Object)

コレクションに特定の値が格納されているかどうかを判断します。

IList.IndexOf(Object)

コレクション内で指定した項目のインデックスを調べます。

IList.Insert(Int32, Object)

コレクション内の指定したインデックスの位置に項目を挿入します。

IList.IsFixedSize

コレクションが固定サイズかどうかを示す値を取得します。

IList.IsReadOnly

コレクションが読み取り専用かどうかを示す値を取得します。

IList.Item[Int32]

コレクション内の指定したインデックス位置の項目を取得または設定します。

IList.Remove(Object)

最初に出現する指定値をコレクションから削除します。

IList.RemoveAt(Int32)

指定したインデックス位置にある項目を削除します。

拡張メソッド

Cast<TResult>(IEnumerable)

IEnumerable の要素を、指定した型にキャストします。

OfType<TResult>(IEnumerable)

指定された型に基づいて IEnumerable の要素をフィルター処理します。

AsParallel(IEnumerable)

クエリの並列化を有効にします。

AsQueryable(IEnumerable)

IEnumerableIQueryable に変換します。

適用対象

こちらもご覧ください