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

<ComVisibleAttribute(True)> _ Public MustInherit Class PropertyDescriptor Inherits MemberDescriptor

プロパティの説明は、プロパティの名前、属性、そのプロパティが関連付けられているコンポーネント クラス、およびプロパティの型で構成されています。
PropertyDescriptor は、次のプロパティとメソッドを提供します。
また、PropertyDescriptor は、次の abstract のプロパティとメソッドを提供します。
-
ComponentType は、プロパティが関連付けられているコンポーネントの型を格納します。
通常、abstract メンバはリフレクションによって実装されます。リフレクションの詳細については、リフレクション のトピックを参照してください。
![]() |
---|
このクラスに適用される HostProtectionAttribute 属性の Resources プロパティの値は、SharedState です。HostProtectionAttribute は、デスクトップ アプリケーション (一般的には、アイコンをダブルクリック、コマンドを入力、またはブラウザに URL を入力して起動するアプリケーション) には影響しません。詳細については、HostProtectionAttribute クラスのトピックまたは「SQL Server プログラミングとホスト保護属性」を参照してください。 |

PropertyDescriptorCollection クラスの例に基づいて構築されているコード例を次に示します。テキスト ボックス内のボタンのテキストに関する情報 (カテゴリ、説明、表示名) を出力します。この例は、button1 と textbox1 がフォーム上でインスタンス化されていることを前提としています。
' Creates a new collection and assign it the properties for button1. Dim properties As PropertyDescriptorCollection = TypeDescriptor.GetProperties(Button1) ' Sets an PropertyDescriptor to the specific property. Dim myProperty As PropertyDescriptor = properties.Find("Text", False) ' Prints the property and the property description. TextBox1.Text += myProperty.DisplayName & Microsoft.VisualBasic.ControlChars.Cr TextBox1.Text += myProperty.Description & Microsoft.VisualBasic.ControlChars.Cr TextBox1.Text += myProperty.Category & Microsoft.VisualBasic.ControlChars.Cr
// Creates a new collection and assign it the properties for button1. PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1); // Sets an PropertyDescriptor to the specific property. System.ComponentModel.PropertyDescriptor myProperty = properties.Find("Text", false); // Prints the property and the property description. textBox1.Text = myProperty.DisplayName+ '\n' ; textBox1.Text += myProperty.Description + '\n'; textBox1.Text += myProperty.Category + '\n';
// Creates a new collection and assign it the properties for button1. PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); // Sets an PropertyDescriptor to the specific property. System::ComponentModel::PropertyDescriptor^ myProperty = properties->Find( "Text", false ); // Prints the property and the property description. textBox1->Text = String::Concat( myProperty->DisplayName, "\n" ); textBox1->Text = String::Concat( textBox1->Text, myProperty->Description, "\n" ); textBox1->Text = String::Concat( textBox1->Text, myProperty->Category, "\n" );
// Creates a new collection and assign it the properties for button1. PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1); // Sets an PropertyDescriptor to the specific property. System.ComponentModel.PropertyDescriptor myProperty = properties.Find("Text", false); // Prints the property and the property description. textBox1.set_Text(myProperty.get_DisplayName() + 'n'); textBox1.set_Text(textBox1.get_Text() + myProperty.get_Description() + '\n'); textBox1.set_Text(textBox1.get_Text() + myProperty.get_Category() + '\n');

System.ComponentModel.MemberDescriptor
System.ComponentModel.PropertyDescriptor
System.ComponentModel.TypeConverter.SimplePropertyDescriptor


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


PropertyDescriptor メンバ
System.ComponentModel 名前空間
MemberDescriptor クラス
Attribute
DefaultValueAttribute クラス
- PropertyDescriptor クラスのページへのリンク