PropertyDescriptorCollection クラス
アセンブリ: System (system.dll 内)


PropertyDescriptorCollection は読み取り専用であり、プロパティの追加または削除を行うためのメソッドは実装していません。これらのメソッドを実装するには、このクラスから継承する必要があります。
PropertyDescriptorCollection クラスで利用できるプロパティを使用して、コレクションに対してその内容を照会できます。コレクション内の要素の数を確認するには、Count プロパティを使用します。インデックス番号または名前で指定したプロパティを取得するには、Item プロパティを使用します。
プロパティのほかにも、Find メソッドを使用して、指定した名前を持つプロパティの説明をコレクションから取得することもできます。
![]() |
---|
このクラスに適用される HostProtectionAttribute 属性の Resources プロパティの値は、Synchronization です。HostProtectionAttribute は、デスクトップ アプリケーション (一般的には、アイコンをダブルクリック、コマンドを入力、またはブラウザに URL を入力して起動するアプリケーション) には影響しません。詳細については、HostProtectionAttribute クラスのトピックまたは「SQL Server プログラミングとホスト保護属性」を参照してください。 |

button1 のプロパティを使用して、新しい PropertyDescriptorCollection を作成するコード例を次に示します。この例では、button1 がフォーム上でインスタンス化されていることが必要です。
Dim properties As PropertyDescriptorCollection = TypeDescriptor.GetProperties(button1)
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1);
PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 );
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1);
ボタンに関するすべてのプロパティをテキスト ボックスに出力する例を次に示します。この例では、button1 と textBox1 がフォーム上でインスタンス化されていることが必要です。
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 'MyPropertyCollection
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: 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. for (int iCtr = 0; iCtr < properties.get_Count(); iCtr++) { PropertyDescriptor myProperty = properties.get_Item(iCtr); textBox1.set_Text(myProperty.get_Name() + '\n'); } } //MyPropertyCollection

System.ComponentModel.PropertyDescriptorCollection


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- PropertyDescriptorCollection クラスのページへのリンク