大文字と小文字の違いを無視するかどうかを示すブール値を使用して、指定した名前の PropertyDescriptor を返します。
Public Overridable Function Find( _
ByVal name As String, _ ByVal ignoreCase As Boolean _) As PropertyDescriptor
[C#]
public virtual PropertyDescriptor Find(stringname,boolignoreCase);
[C++]
public: virtual PropertyDescriptor* Find(String* name,boolignoreCase);
[JScript]
public function Find(
name : String,ignoreCase : Boolean) : PropertyDescriptor;
パラメータ
- name
コレクションから返す PropertyDescriptor の名前。 - ignoreCase
プロパティ名の大文字と小文字を区別しない場合は true 。それ以外の場合は false 。
戻り値
指定した名前の PropertyDescriptor 。そのようなプロパティが存在しない場合は null 参照 (Visual Basic では Nothing) 。
使用例
[Visual Basic, C#, C++] 特定の 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
[C#]
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;
}
[C++]
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(S"Opacity", false);
// Prints the property and the property description.
textBox1->Text = String::Concat( myProperty->DisplayName, S"\n", myProperty->Description );
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン
をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
参照
PropertyDescriptorCollection クラス | PropertyDescriptorCollection メンバ | System.ComponentModel 名前空間 | PropertyDescriptor | TypeDescriptor