PropertyDescriptorCollection.Find メソッド
アセンブリ: System (system.dll 内)
構文Public Overridable Function Find ( _ name As String, _ ignoreCase As Boolean _ ) As PropertyDescriptor
Dim instance As PropertyDescriptorCollection Dim name As String Dim ignoreCase As Boolean Dim returnValue As PropertyDescriptor returnValue = instance.Find(name, ignoreCase)
- name
コレクションから返す PropertyDescriptor の名前。
指定した名前の PropertyDescriptor。そのようなプロパティが存在しない場合は null 参照 (Visual Basic では Nothing)。
使用例特定の PropertyDescriptor を検索するコード例を次に示します。見つかった PropertyDescriptor のコンポーネントの型をテキスト ボックスに出力します。この例では、button1 と textBox1 がフォーム上でインスタンス化されていることが必要です。
Private Sub FindProperty() ' Creates a new collection and assign it the properties for button1. Dim properties As PropertyDescriptorCollection = _ TypeDescriptor.GetProperties(button1) ' Sets a PropertyDescriptor to the specific property. Dim myProperty As PropertyDescriptor = properties.Find("Opacity", False) ' Prints the property and the property description. textBox1.Text = myProperty.DisplayName & _ Microsoft.VisualBasic.ControlChars.Cr & myProperty.Description End Sub
private void FindProperty() { // Creates a new collection and assign it the properties for button1. PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1); // Sets a PropertyDescriptor to the specific property. PropertyDescriptor myProperty = properties.Find("Opacity", false); // Prints the property and the property description. textBox1.Text = myProperty.DisplayName + '\n' + myProperty.Description; }
private: void FindProperty() { // Creates a new collection and assign it the properties for button1. PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); // Sets a PropertyDescriptor to the specific property. PropertyDescriptor^ myProperty = properties->Find( "Opacity", false ); // Prints the property and the property description. textBox1->Text = myProperty->DisplayName + "\n" + myProperty->Description; }
private void FindProperty() { // Creates a new collection and assign it the properties for button1. PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1); // Sets a PropertyDescriptor to the specific property. PropertyDescriptor myProperty = properties.Find("Opacity", false); // Prints the property and the property description. textBox1.set_Text(myProperty.get_DisplayName() + '\n' + myProperty.get_Description()); } //FindProperty
プラットフォーム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 クラス
PropertyDescriptorCollection メンバ
System.ComponentModel 名前空間
PropertyDescriptor クラス
TypeDescriptor
- PropertyDescriptorCollection.Find メソッドのページへのリンク