Type.GetPropertyImpl(String, BindingFlags, Binder, Type, Type[], ParameterModifier[]) Type.GetPropertyImpl(String, BindingFlags, Binder, Type, Type[], ParameterModifier[]) Type.GetPropertyImpl(String, BindingFlags, Binder, Type, Type[], ParameterModifier[]) Method

定義

在衍生類別中覆寫時,使用指定的繫結條件約束搜尋指定的屬性,而該屬性的參數符合指定的引數類型和修飾詞的建構函式。When overridden in a derived class, searches for the specified property whose parameters match the specified argument types and modifiers, using the specified binding constraints.

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

參數

name
String String String

字串,包含要取得的屬性名稱。The string containing the name of the property to get.

bindingAttr
BindingFlags BindingFlags BindingFlags

列舉值的位元組合,用來指定搜尋的執行方式。A bitwise combination of the enumeration values that specify how the search is conducted.

-或--or- 要傳回 nullDefaultDefault to return null.

binder
Binder Binder Binder

定義一組屬性並啟用繫結的物件,可包含多載成員的選擇、引數類型的強制,以及透過反映的成員引動過程。An object that defines a set of properties and enables binding, which can involve selection of an overloaded member, coercion of argument types, and invocation of a member through reflection.

-或--or- Null 參考 (在 Visual Basic 中為 Nothing),可使用 DefaultBinderA null reference (Nothing in Visual Basic), to use the DefaultBinder.

returnType
Type Type Type

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

types
Type[]

Type 物件的陣列,代表所要取得之索引屬性的參數數目、順序和類型。An array of Type objects representing the number, order, and type of the parameters for the indexed property to get.

-或--or- 用以取得未編製索引的屬性之 Type 類型的空陣列 (也就是,Type[] types = new Type[0])。An empty array of the type Type (that is, Type[] types = new Type[0]) to get a property that is not indexed.

modifiers
ParameterModifier[]

ParameterModifier 物件的陣列,代表在 types 陣列中與對應項目關聯的屬性。An array of ParameterModifier objects representing the attributes associated with the corresponding element in the types array. 預設的繫結器不會處理這個參數。The default binder does not process this parameter.

傳回

代表符合指定之需求屬性的物件 (如有找到);否則為 nullAn object representing the property that matches the specified requirements, if found; otherwise, null.

例外狀況

找到一個以上的屬性,其具有指定名稱,且符合指定繫結條件約束。More than one property is found with the specified name and matching the specified binding constraints.

namenullname is null.

-或--or- typesnulltypes is null.

-或--or- types 的其中一個項目為 nullOne of the elements in types is null.

types 是多維的。types is multidimensional.

-或--or- modifiers 是多維的。modifiers is multidimensional.

-或--or- typesmodifiers 的長度不同。types and modifiers do not have the same length.

備註

雖然預設繫結器不會處理ParameterModifier(modifiers參數),您可以使用抽象System.Reflection.Binder類別,以寫入未處理的自訂繫結器modifiersAlthough the default binder does not process ParameterModifier (the modifiers parameter), you can use the abstract System.Reflection.Binder class to write a custom binder that does process modifiers. ParameterModifier 透過 COM interop 呼叫時才會使用和處理傳址方式傳遞的參數。ParameterModifier is only used when calling through COM interop, and only parameters that are passed by reference are handled.

下列BindingFlags篩選器旗標可以用來定義要在搜尋中包含的屬性:The following BindingFlags filter flags can be used to define which properties to include in the search:

  • 您必須指定BindingFlags.InstanceBindingFlags.Static以取得傳回值。You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  • 指定BindingFlags.Public来包含在搜尋中的公用屬性。Specify BindingFlags.Public to include public properties in the search.

  • 指定BindingFlags.NonPublic要在搜尋中包含非公用屬性 (也就是私用、 內部和受保護的屬性)。Specify BindingFlags.NonPublic to include non-public properties (that is, private, internal, and protected properties) in the search.

  • 指定BindingFlags.FlattenHierarchy包含publicprotected階層; 的靜態成員private中繼承類別的靜態成員不包含。Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

下列BindingFlags輔助鍵旗標可以用來變更搜尋的運作方式:The following BindingFlags modifier flags can be used to change how the search works:

  • BindingFlags.IgnoreCase 忽略大小寫的nameBindingFlags.IgnoreCase to ignore the case of name.

  • BindingFlags.DeclaredOnly 搜尋僅屬性宣告上Type,不只是繼承的屬性。BindingFlags.DeclaredOnly to search only the properties declared on the Type, not properties that were simply inherited.

如需詳細資訊,請參閱 System.Reflection.BindingFlagsSee System.Reflection.BindingFlags for more information.

適用於

另請參閱