PropertyDescriptorCollection.Find(String, Boolean) Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Devolve o PropertyDescriptor com o nome especificado, usando um Booleano para indicar se deve ignorar o caso.
public:
virtual System::ComponentModel::PropertyDescriptor ^ Find(System::String ^ name, bool ignoreCase);
public virtual System.ComponentModel.PropertyDescriptor? Find(string name, bool ignoreCase);
public virtual System.ComponentModel.PropertyDescriptor Find(string name, bool ignoreCase);
abstract member Find : string * bool -> System.ComponentModel.PropertyDescriptor
override this.Find : string * bool -> System.ComponentModel.PropertyDescriptor
Public Overridable Function Find (name As String, ignoreCase As Boolean) As PropertyDescriptor
Parâmetros
- name
- String
O nome do PropertyDescriptor a regressar da coleção.
- ignoreCase
- Boolean
true Se quiseres ignorar o caso do nome da propriedade; caso contrário, false.
Devoluções
A PropertyDescriptor com o nome especificado, ou null se a propriedade não existir.
Exemplos
O seguinte exemplo de código encontra um .PropertyDescriptor Imprime o tipo de componente para isto PropertyDescriptor numa caixa de texto. Requer isso button1 e textBox1 ter sido instanciado num formulário.
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;
}
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 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