_Type.GetConstructors 方法

定義

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

多載

GetConstructors()

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

GetConstructors(BindingFlags)

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

備註

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

Type.GetConstructors 方法會取得目前 Type的函式。The Type.GetConstructors method gets the constructors of the current Type.

GetConstructors()

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

public:
 cli::array <System::Reflection::ConstructorInfo ^> ^ GetConstructors();
public System.Reflection.ConstructorInfo[] GetConstructors ();
abstract member GetConstructors : unit -> System.Reflection.ConstructorInfo[]
Public Function GetConstructors () As ConstructorInfo()

傳回

ConstructorInfo 物件組成的陣列,表示定義給目前 Type 的所有公用執行個體建構函式,但不含類型初始設定式 (靜態建構函式)。An array of ConstructorInfo objects representing all the public instance constructors defined for the current Type, but not including the type initializer (static constructor). 如果目前的 Type 沒有定義任何公用執行個體建構函式,或目前的 Type 代表的是泛型型別或方法定義的型別參數,則會傳回 ConstructorInfo 型別的空陣列。If no public instance constructors are defined for the current Type, or if the current Type represents a type parameter of a generic type or method definition, an empty array of type ConstructorInfo is returned.

備註

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

Type.GetConstructors 方法會傳回針對目前 Type定義的所有公用函數。The Type.GetConstructors method returns all the public constructors defined for the current Type.

GetConstructors(BindingFlags)

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

public:
 cli::array <System::Reflection::ConstructorInfo ^> ^ GetConstructors(System::Reflection::BindingFlags bindingAttr);
public System.Reflection.ConstructorInfo[] GetConstructors (System.Reflection.BindingFlags bindingAttr);
abstract member GetConstructors : System.Reflection.BindingFlags -> System.Reflection.ConstructorInfo[]
Public Function GetConstructors (bindingAttr As BindingFlags) As ConstructorInfo()

參數

bindingAttr
BindingFlags

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

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

傳回

ConstructorInfo 物件的陣列,代表為目前 Type 定義之符合指定繫結條件約束的所有建構函式,包括類型初始設定式 (如果已定義)。An array of ConstructorInfo objects representing all constructors defined for the current Type that match the specified binding constraints, including the type initializer if it is defined. 如果目前的 ConstructorInfo 沒有定義建構函式,或所定義的建構函式都不符合繫結條件約束,或目前的 Type 代表的是泛型型別或方法定義的型別參數,則傳回 Type 型別的空陣列。Returns an empty array of type ConstructorInfo if no constructors are defined for the current Type, if none of the defined constructors match the binding constraints, or if the current Type represents a type parameter of a generic type or method definition.

備註

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

Type.GetConstructors 方法會使用指定的 BindingFlags,搜尋為目前 Type定義的函數。The Type.GetConstructors method searches for the constructors defined for the current Type, using the specified BindingFlags.

適用於