ConstructorInfo Class
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Discovers the attributes of a class constructor and provides access to constructor metadata.
System.Reflection::MemberInfo
System.Reflection::MethodBase
System.Reflection::ConstructorInfo
Assembly: mscorlib (in mscorlib.dll)
The ConstructorInfo type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | Attributes | Gets the attributes associated with this method. (Inherited from MethodBase.) |
![]() | CallingConvention | Gets a value that indicates the calling conventions for this method. (Inherited from MethodBase.) |
![]() | ContainsGenericParameters | Gets a value that indicates whether the generic method contains unassigned generic type parameters. (Inherited from MethodBase.) |
![]() | CustomAttributes | Gets a collection that contains this member's custom attributes. (Inherited from MemberInfo.) |
![]() | DeclaringType | Gets the class that declares this member. (Inherited from MemberInfo.) |
![]() | IsAbstract | Gets a value that indicates whether the method is abstract (MustInherit in Visual Basic). (Inherited from MethodBase.) |
![]() | IsAssembly | Gets a value that indicates whether the potential visibility of this method or constructor is described by MethodAttributes::Assembly; that is, the method or constructor is visible at most to other types in the same assembly, and is not visible to derived types outside the assembly. (Inherited from MethodBase.) |
![]() | IsConstructor | Gets a value that indicates whether the method is a constructor. (Inherited from MethodBase.) |
![]() | IsFamily | Gets a value that indicates whether the visibility of this method or constructor is described by MethodAttributes::Family; that is, the method or constructor is visible only within its class and derived classes. (Inherited from MethodBase.) |
![]() | IsFamilyAndAssembly | Gets a value that indicates whether the visibility of this method or constructor is described by MethodAttributes::FamANDAssem; that is, the method or constructor can be called by derived classes, but only if they are in the same assembly. (Inherited from MethodBase.) |
![]() | IsFamilyOrAssembly | Gets a value that indicates whether the potential visibility of this method or constructor is described by MethodAttributes::FamORAssem; that is, the method or constructor can be called by derived classes wherever they are, and by classes in the same assembly. (Inherited from MethodBase.) |
![]() | IsFinal | Gets a value that indicates whether this method is final (NotOverridable in Visual Basic). (Inherited from MethodBase.) |
![]() | IsGenericMethod | Gets a value that indicates whether the method is generic. (Inherited from MethodBase.) |
![]() | IsGenericMethodDefinition | Gets a value that indicates whether the method is a generic method definition. (Inherited from MethodBase.) |
![]() | IsHideBySig | Gets a value that indicates whether only a member of the same kind with exactly the same signature is hidden in the derived class. (Inherited from MethodBase.) |
![]() | IsPrivate | Gets a value that indicates whether this member is private. (Inherited from MethodBase.) |
![]() | IsPublic | Gets a value that indicates whether this is a public method. (Inherited from MethodBase.) |
![]() | IsSpecialName | Gets a value that indicates whether this method has a special name. (Inherited from MethodBase.) |
![]() | IsStatic | Gets a value that indicates whether the method is static (Shared in Visual Basic). (Inherited from MethodBase.) |
![]() | IsVirtual | Gets a value that indicates whether the method is virtual (Overridable in Visual Basic). (Inherited from MethodBase.) |
![]() | MemberType | Gets a MemberTypes value indicating that this member is a constructor. (Overrides MemberInfo::MemberType.) |
![]() | MetadataToken | Gets a value that identifies a metadata element. (Inherited from MemberInfo.) |
![]() | MethodHandle | Gets a handle to the internal metadata representation of a method. (Inherited from MethodBase.) |
![]() | MethodImplementationFlags | Gets the MethodImplAttributes flags that specify the attributes of a method implementation. (Inherited from MethodBase.) |
![]() | Module | Gets the module in which the type that declares the member represented by the current MemberInfo is defined. (Inherited from MemberInfo.) |
![]() | Name | Gets the name of the current member. (Inherited from MemberInfo.) |
![]() | ReflectedType | Gets the class object that was used to obtain this instance of MemberInfo. (Inherited from MemberInfo.) |
| Name | Description | |
|---|---|---|
![]() | Equals | Returns a value that indicates whether this instance is equal to a specified object. (Overrides MethodBase::Equals(Object).) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetCustomAttributes(Boolean) | When overridden in a derived class, returns an array of all custom attributes applied to this member. (Inherited from MemberInfo.) |
![]() | GetCustomAttributes(Type, Boolean) | When overridden in a derived class, returns an array of custom attributes applied to this member and identified by Type. (Inherited from MemberInfo.) |
![]() | GetGenericArguments | Returns an array of Type objects that represent the type arguments of a generic method or the type parameters of a generic method definition. (Inherited from MethodBase.) |
![]() | GetHashCode | Returns the hash code for this instance. (Overrides MethodBase::GetHashCode().) |
![]() | GetMethodImplementationFlags | When overridden in a derived class, returns the MethodImplAttributes flags. (Inherited from MethodBase.) |
![]() | GetParameters | When overridden in a derived class, gets the parameters of this method or constructor. (Inherited from MethodBase.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | Invoke(array<Object>) | Invokes the current constructor with the specified arguments. |
![]() | Invoke(Object, array<Object>) | Invokes the method or constructor represented by the current instance, using the specified parameters. (Inherited from MethodBase.) |
![]() | Invoke(BindingFlags, Binder, array<Object>, CultureInfo) | When implemented in a derived class, invokes the current constructor with the specified arguments, using the specified binder and culture to validate the argument types. |
![]() | Invoke(Object, BindingFlags, Binder, array<Object>, CultureInfo) | When overridden in a derived class, invokes the reflected method or constructor with the given parameters. (Inherited from MethodBase.) |
![]() | IsDefined | When overridden in a derived class, indicates whether one or more attributes of the specified type or of its derived types is applied to this member. (Inherited from MemberInfo.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() | GetCustomAttribute(Type) | Overloaded. Retrieves a custom attribute of a specified type that is applied to a specified member. (Defined by CustomAttributeExtensions.) |
![]() | GetCustomAttribute(Type, Boolean) | Overloaded. Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member. (Defined by CustomAttributeExtensions.) |
![]() | GetCustomAttribute<T>() | Overloaded. Retrieves a custom attribute of a specified type that is applied to a specified member. (Defined by CustomAttributeExtensions.) |
![]() | GetCustomAttribute<T>(Boolean) | Overloaded. Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member. (Defined by CustomAttributeExtensions.) |
![]() | GetCustomAttributes() | Overloaded. Retrieves a collection of custom attributes that are applied to a specified member. (Defined by CustomAttributeExtensions.) |
![]() | GetCustomAttributes(Type) | Overloaded. Retrieves a collection of custom attributes of a specified type that are applied to a specified member. (Defined by CustomAttributeExtensions.) |
![]() | GetCustomAttributes<T>() | Overloaded. Retrieves a collection of custom attributes of a specified type that are applied to a specified member. (Defined by CustomAttributeExtensions.) |
![]() | GetCustomAttributes<T>(Boolean) | Overloaded. Retrieves a collection of custom attributes of a specified type that are applied to a specified member, and optionally inspects the ancestors of that member. (Defined by CustomAttributeExtensions.) |
![]() | IsDefined | Indicates whether custom attributes of a specified type are applied to a specified member. (Defined by CustomAttributeExtensions.) |
| Name | Description | |
|---|---|---|
![]() ![]() | ConstructorName | Represents the name of the class constructor method as it is stored in metadata. This name is always ".ctor". This field is read-only. |
![]() ![]() | TypeConstructorName | Represents the name of the type constructor method as it is stored in metadata. This name is always ".cctor". This property is read-only. |
In Windows Phone, you cannot derive from this type.
ConstructorInfo is used to discover the attributes of a constructor and to invoke a constructor. Objects are created by calling Invoke on a ConstructorInfo returned by either the GetConstructors or GetConstructor method of a Type object.
Note: |
|---|
ConstructorInfo inherits several members from MethodBase, such as IsGenericMethod, that can be used to examine generic methods. Constructors cannot be generic, so these members return false or nullptr. |
Version Notes
Windows Phone
If you call a static constructor using reflection, the application throws ArgumentException instead of MethodAccessException.The following example uses ConstructorInfo with GetConstructor and BindingFlags to find the constructors that match the specified search criteria.
Note: |
|---|
To run this example, see Building examples that have static TextBlock controls for Windows Phone 8. |






Note: