_Type.GetProperty Method

Definition

為 COM 物件提供與版本無關的 GetProperty 方法之存取權。Provides COM objects with version-independent access to the GetProperty method.

Overloads

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

為 COM 物件提供與版本無關的 GetProperty(String, Type, Type[], ParameterModifier[]) 方法之存取權。Provides COM objects with version-independent access to the GetProperty(String, Type, Type[], ParameterModifier[]) method.

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

為 COM 物件提供與版本無關的 GetProperty(String, BindingFlags, Binder, Type, Type[], ParameterModifier[]) 方法之存取權。Provides COM objects with version-independent access to the GetProperty(String, BindingFlags, Binder, Type, Type[], ParameterModifier[]) method.

GetProperty(String, Type, Type[])

為 COM 物件提供與版本無關的 GetProperty(String, Type, Type[]) 方法之存取權。Provides COM objects with version-independent access to the GetProperty(String, Type, Type[]) method.

GetProperty(String, Type)

為 COM 物件提供與版本無關的 GetProperty(String, Type) 方法之存取權。Provides COM objects with version-independent access to the GetProperty(String, Type) method.

GetProperty(String, Type[])

為 COM 物件提供與版本無關的 GetProperty(String, Type[]) 方法之存取權。Provides COM objects with version-independent access to the GetProperty(String, Type[]) method.

GetProperty(String, BindingFlags)

為 COM 物件提供與版本無關的 GetProperty(String, BindingFlags) 方法之存取權。Provides COM objects with version-independent access to the GetProperty(String, BindingFlags) method.

GetProperty(String)

為 COM 物件提供與版本無關的 GetProperty(String) 方法之存取權。Provides COM objects with version-independent access to the GetProperty(String) method.

Remarks

這個方法是用來從非受控程式碼存取 managed 類別,而且不應該從 managed 程式碼呼叫。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetProperty 方法會取得目前 Type的特定屬性。The Type.GetProperty method gets a specific property of the current Type.

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

為 COM 物件提供與版本無關的 GetProperty(String, Type, Type[], ParameterModifier[]) 方法之存取權。Provides COM objects with version-independent access to the GetProperty(String, Type, Type[], ParameterModifier[]) method.

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

Parameters

name
String

String,包含要取得的公用屬性名稱。The String containing the name of the public property to get.

returnType
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.

Returns

PropertyInfo

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

Remarks

這個方法是用來從非受控程式碼存取 managed 類別,而且不應該從 managed 程式碼呼叫。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetProperty 方法會搜尋指定的公用屬性,其參數符合指定的引數類型和修飾詞。The Type.GetProperty method searches for the specified public property whose parameters match the specified argument types and modifiers.

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

為 COM 物件提供與版本無關的 GetProperty(String, BindingFlags, Binder, Type, Type[], ParameterModifier[]) 方法之存取權。Provides COM objects with version-independent access to the GetProperty(String, BindingFlags, Binder, Type, Type[], ParameterModifier[]) method.

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

Parameters

name
String

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

bindingAttr
BindingFlags

位元遮罩,由一或多個 BindingFlags 組成,而這些旗標會指定執行搜尋的方式。A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-或--or- 零,傳回 nullZero, to return null.

binder
Binder

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

-或--or- null,則使用 DefaultBindernull, to use the DefaultBinder.

returnType
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.

Returns

PropertyInfo

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

Remarks

這個方法是用來從非受控程式碼存取 managed 類別,而且不應該從 managed 程式碼呼叫。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetProperty 方法會使用指定的系結條件約束,搜尋指定的屬性,其參數符合指定的引數類型和修飾詞。The Type.GetProperty method searches for the specified property whose parameters match the specified argument types and modifiers, using the specified binding constraints.

GetProperty(String, Type, Type[])

為 COM 物件提供與版本無關的 GetProperty(String, Type, Type[]) 方法之存取權。Provides COM objects with version-independent access to the GetProperty(String, Type, Type[]) method.

public:
 System::Reflection::PropertyInfo ^ GetProperty(System::String ^ name, Type ^ returnType, cli::array <Type ^> ^ types);
public System.Reflection.PropertyInfo GetProperty (string name, Type returnType, Type[] types);
abstract member GetProperty : string * Type * Type[] -> System.Reflection.PropertyInfo
Public Function GetProperty (name As String, returnType As Type, types As Type()) As PropertyInfo

Parameters

name
String

String,包含要取得的公用屬性名稱。The String containing the name of the public property to get.

returnType
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.

Returns

PropertyInfo

PropertyInfo 物件,表示其參數符合指定之引數類型的公用屬性 (如有找到);否則為 nullA PropertyInfo object representing the public property whose parameters match the specified argument types, if found; otherwise, null.

Remarks

這個方法是用來從非受控程式碼存取 managed 類別,而且不應該從 managed 程式碼呼叫。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetProperty 方法會搜尋指定的公用屬性,其參數符合指定的引數類型。The Type.GetProperty method searches for the specified public property whose parameters match the specified argument types.

GetProperty(String, Type)

為 COM 物件提供與版本無關的 GetProperty(String, Type) 方法之存取權。Provides COM objects with version-independent access to the GetProperty(String, Type) method.

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

Parameters

name
String

String,包含要取得的公用屬性名稱。The String containing the name of the public property to get.

returnType
Type

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

Returns

PropertyInfo

PropertyInfo 物件,表示具有指定之名稱的公用屬性 (如有找到);否則為 nullA PropertyInfo object representing the public property with the specified name, if found; otherwise, null.

Remarks

這個方法是用來從非受控程式碼存取 managed 類別,而且不應該從 managed 程式碼呼叫。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetProperty 方法會搜尋具有指定之名稱和傳回型別的公用屬性。The Type.GetProperty method searches for the public property with the specified name and return type.

GetProperty(String, Type[])

為 COM 物件提供與版本無關的 GetProperty(String, Type[]) 方法之存取權。Provides COM objects with version-independent access to the GetProperty(String, Type[]) method.

public:
 System::Reflection::PropertyInfo ^ GetProperty(System::String ^ name, cli::array <Type ^> ^ types);
public System.Reflection.PropertyInfo GetProperty (string name, Type[] types);
abstract member GetProperty : string * Type[] -> System.Reflection.PropertyInfo
Public Function GetProperty (name As String, types As Type()) As PropertyInfo

Parameters

name
String

String,包含要取得的公用屬性名稱。The String containing the name of the public property to get.

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.

Returns

PropertyInfo

PropertyInfo 物件,表示其參數符合指定之引數類型的公用屬性 (如有找到);否則為 nullA PropertyInfo object representing the public property whose parameters match the specified argument types, if found; otherwise, null.

Remarks

這個方法是用來從非受控程式碼存取 managed 類別,而且不應該從 managed 程式碼呼叫。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetProperty 方法會搜尋指定的公用屬性,其參數符合指定的引數類型。The Type.GetProperty method searches for the specified public property whose parameters match the specified argument types.

GetProperty(String, BindingFlags)

為 COM 物件提供與版本無關的 GetProperty(String, BindingFlags) 方法之存取權。Provides COM objects with version-independent access to the GetProperty(String, BindingFlags) method.

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

Parameters

name
String

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

bindingAttr
BindingFlags

位元遮罩,由一或多個 BindingFlags 組成,而這些旗標會指定執行搜尋的方式。A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-或--or- 零,傳回 nullZero, to return null.

Returns

PropertyInfo

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

Remarks

這個方法是用來從非受控程式碼存取 managed 類別,而且不應該從 managed 程式碼呼叫。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetProperty 方法會使用指定的系結條件約束,搜尋指定的屬性。The Type.GetProperty method searches for the specified property, using the specified binding constraints.

GetProperty(String)

為 COM 物件提供與版本無關的 GetProperty(String) 方法之存取權。Provides COM objects with version-independent access to the GetProperty(String) method.

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

Parameters

name
String

String,包含要取得的公用屬性名稱。The String containing the name of the public property to get.

Returns

PropertyInfo

PropertyInfo 物件,表示具有指定之名稱的公用屬性 (如有找到);否則為 nullA PropertyInfo object representing the public property with the specified name, if found; otherwise, null.

Remarks

這個方法是用來從非受控程式碼存取 managed 類別,而且不應該從 managed 程式碼呼叫。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetProperty 方法會搜尋具有指定之名稱的公用屬性。The Type.GetProperty method searches for the public property with the specified name.

Applies to