IReflect.GetProperty 方法

定義

擷取 PropertyInfo 物件,對應於指定屬性。Retrieves a PropertyInfo object corresponding to a specified property.

多載

GetProperty(String, BindingFlags)

擷取 PropertyInfo 物件,對應於指定搜尋條件約束下的指定屬性。Retrieves a PropertyInfo object corresponding to a specified property under specified search constraints.

GetProperty(String, BindingFlags, Binder, Type, Type[], ParameterModifier[])

擷取 PropertyInfo 物件,對應至具有指定之搜尋條件約束的指定屬性。Retrieves a PropertyInfo object that corresponds to a specified property with specified search constraints.

GetProperty(String, BindingFlags)

擷取 PropertyInfo 物件,對應於指定搜尋條件約束下的指定屬性。Retrieves a PropertyInfo object corresponding to a specified property under specified search constraints.

public:
 System::Reflection::PropertyInfo ^ GetProperty(System::String ^ name, System::Reflection::BindingFlags bindingAttr);
public System.Reflection.PropertyInfo GetProperty (string name, System.Reflection.BindingFlags bindingAttr);
abstract member GetProperty : string * System.Reflection.BindingFlags -> System.Reflection.PropertyInfo
Public Function GetProperty (name As String, bindingAttr As BindingFlags) As PropertyInfo

參數

name
String

要尋找的屬性名稱。The name of the property to find.

bindingAttr
BindingFlags

繫結屬性,用來控制搜尋。The binding attributes used to control the search.

傳回

所找到屬性的 PropertyInfo 物件 (符合 bindingAttr 中所指定的搜尋條件約束) 或 null (如果未找到屬性)。A PropertyInfo object for the located property that meets the search constraints specified in bindingAttr, or null if the property was not located.

例外狀況

物件會使用相同名稱,實作多重欄位。The object implements multiple fields with the same name.

另請參閱

GetProperty(String, BindingFlags, Binder, Type, Type[], ParameterModifier[])

擷取 PropertyInfo 物件,對應至具有指定之搜尋條件約束的指定屬性。Retrieves a PropertyInfo object that corresponds to a specified property with specified search constraints.

public:
 System::Reflection::PropertyInfo ^ GetProperty(System::String ^ name, System::Reflection::BindingFlags bindingAttr, System::Reflection::Binder ^ binder, Type ^ returnType, cli::array <Type ^> ^ types, cli::array <System::Reflection::ParameterModifier> ^ modifiers);
public System.Reflection.PropertyInfo GetProperty (string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, Type returnType, Type[] types, System.Reflection.ParameterModifier[] modifiers);
abstract member GetProperty : string * System.Reflection.BindingFlags * System.Reflection.Binder * Type * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.PropertyInfo

參數

name
String

要尋找的成員名稱。The name of the member to find.

bindingAttr
BindingFlags

繫結屬性,用來控制搜尋。The binding attribute used to control the search.

binder
Binder

該物件會實作 Binder,其中包含與此方法相關的屬性。An object that implements Binder, containing properties related to this method.

returnType
Type

屬性的類型。The type of the property.

types
Type[]

陣列,用來在具有相同名稱的多載方法中選擇。An array used to choose among overloaded methods with the same name.

modifiers
ParameterModifier[]

陣列,用來選擇參數修飾詞。An array used to choose the parameter modifiers.

傳回

PropertyInfo 物件 (用於所找到的屬性,如果在這個反映物件中找到具有指定名稱的屬性) 或 null (如果找不到屬性)。A PropertyInfo object for the located property, if a property with the specified name was located in this reflection object, or null if the property was not located.

備註

這個方法會在PropertyInfo指定的搜尋條件約束下, 抓取對應于指定之屬性的物件。This method retrieves a PropertyInfo object corresponding to a specified property under specified search constraints. 類型陣列是用來從多載的方法中進行選擇。A type array is used to choose from among overloaded methods.

另請參閱

適用於