IReflect.GetProperty 方法

定義

擷取 PropertyInfo 物件,對應於指定屬性。

多載

GetProperty(String, BindingFlags)

擷取 PropertyInfo 物件,對應於指定搜尋條件約束下的指定屬性。

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

擷取 PropertyInfo 物件,對應至具有指定之搜尋條件約束的指定屬性。

GetProperty(String, BindingFlags)

擷取 PropertyInfo 物件,對應於指定搜尋條件約束下的指定屬性。

public:
 System::Reflection::PropertyInfo ^ GetProperty(System::String ^ name, System::Reflection::BindingFlags bindingAttr);
public System.Reflection.PropertyInfo? GetProperty (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

要尋找的屬性名稱。

bindingAttr
BindingFlags

繫結屬性,用來控制搜尋。

傳回

PropertyInfo

所找到屬性的 PropertyInfo 物件 (符合 bindingAttr 中所指定的搜尋條件約束) 或 null (如果未找到屬性)。

例外狀況

物件會使用相同名稱,實作多重欄位。

另請參閱

適用於

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

擷取 PropertyInfo 物件,對應至具有指定之搜尋條件約束的指定屬性。

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);
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
Public Function GetProperty (name As String, bindingAttr As BindingFlags, binder As Binder, returnType As Type, types As Type(), modifiers As ParameterModifier()) As PropertyInfo

參數

name
String

要尋找的成員名稱。

bindingAttr
BindingFlags

繫結屬性,用來控制搜尋。

binder
Binder

該物件會實作 Binder,其中包含與此方法相關的屬性。

returnType
Type

屬性的類型。

types
Type[]

陣列,用來在具有相同名稱的多載方法中選擇。

modifiers
ParameterModifier[]

陣列,用來選擇參數修飾詞。

傳回

PropertyInfo

PropertyInfo 物件 (用於所找到的屬性,如果在這個反映物件中找到具有指定名稱的屬性) 或 null (如果找不到屬性)。

備註

這個方法會 PropertyInfo 擷取對應至指定搜尋條件約束下指定屬性的物件。 類型陣列可用來從多載方法中選擇。

另請參閱

適用於