DefaultConstructorInfo

Ecng.Reflection

Initializes a new instance of the DefaultConstructorInfo class.

继承自: ConstructorInfo

构造函数

DefaultConstructorInfo
public DefaultConstructorInfo(Type type)
defaultConstructorInfo = DefaultConstructorInfo(type)

Initializes a new instance of the DefaultConstructorInfo class.

type
The type.

属性

Attributes
public override MethodAttributes Attributes { get; }
value = defaultConstructorInfo.Attributes

Gets the attributes associated with this method.

返回值: One of the MethodAttributes values.

DeclaringType
public override Type DeclaringType { get; }
value = defaultConstructorInfo.DeclaringType

Gets the class that declares this member.

返回值: The Type object for the class that declares this member.

MethodHandle
public override RuntimeMethodHandle MethodHandle { get; }
value = defaultConstructorInfo.MethodHandle

Gets a handle to the internal metadata representation of a method.

返回值: A RuntimeMethodHandle object.

Name
public override string Name { get; }
value = defaultConstructorInfo.Name

Gets the name of the current member.

返回值: A String containing the name of this member.

ReflectedType
public override Type ReflectedType { get; }
value = defaultConstructorInfo.ReflectedType

Gets the class object that was used to obtain this instance of MemberInfo.

返回值: The Type object through which this MemberInfo object was obtained.

方法

GetCustomAttributes
public override object[] GetCustomAttributes(Type attributeType, bool inherit)
result = defaultConstructorInfo.GetCustomAttributes(attributeType, inherit)

When overridden in a derived class, returns an array of custom attributes identified by Type.

attributeType
The type of attribute to search for. Only attributes that are assignable to this type are returned.
inherit
Specifies whether to search this member's inheritance chain to find the attributes.

返回值: An array of custom attributes applied to this member, or an array with zero (0) elements if no attributes have been applied.

GetCustomAttributes
public override object[] GetCustomAttributes(bool inherit)
result = defaultConstructorInfo.GetCustomAttributes(inherit)

When overridden in a derived class, returns an array containing all the custom attributes.

inherit
Specifies whether to search this member's inheritance chain to find the attributes.

返回值: An array that contains all the custom attributes, or an array with zero elements if no attributes are defined.

GetMethodImplementationFlags
public override MethodImplAttributes GetMethodImplementationFlags()
result = defaultConstructorInfo.GetMethodImplementationFlags()

When overridden in a derived class, returns the MethodImplAttributes flags.

返回值: The MethodImplAttributes flags.

GetParameters
public override ParameterInfo[] GetParameters()
result = defaultConstructorInfo.GetParameters()

When overridden in a derived class, gets the parameters of the specified method or constructor.

返回值: An array of type ParameterInfo containing information that matches the signature of the method (or constructor) reflected by this MethodBase instance.

Invoke
public override object Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
result = defaultConstructorInfo.Invoke(invokeAttr, binder, parameters, culture)

When implemented in a derived class, invokes the constructor reflected by this ConstructorInfo with the specified arguments, under the constraints of the specified Binder.

invokeAttr
One of the BindingFlags values that specifies the type of binding.
binder
A Binder that defines a set of properties and enables the binding, coercion of argument types, and invocation of members using reflection. If binder is null, then Binder.DefaultBinding is used.
parameters
An array of type Object used to match the number, order and type of the parameters for this constructor, under the constraints of binder. If this constructor does not require parameters, pass an array with zero elements, as in Object[] parameters = new Object[0]. Any object in this array that is not explicitly initialized with a value will contain the default value for that object type. For reference-type elements, this value is null. For value-type elements, this value is 0, 0.0, or false, depending on the specific element type.
culture
A CultureInfo used to govern the coercion of types. If this is null, the CultureInfo for the current thread is used.

返回值: An instance of the class associated with the constructor.

Invoke
public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
result = defaultConstructorInfo.Invoke(obj, invokeAttr, binder, parameters, culture)

When overridden in a derived class, invokes the reflected method or constructor with the given parameters.

obj
The object on which to invoke the method or constructor. If a method is static, this argument is ignored. If a constructor is static, this argument must be null or an instance of the class that defines the constructor.
invokeAttr
A bit mask that is a combination of 0 or more bit flags from BindingFlags. If binder is null, this parameter is assigned the value Default; thus, whatever you pass in is ignored.
binder
An object that enables the binding, coercion of argument types, invocation of members, and retrieval of MemberInfo objects via reflection. If binder is null, the default binder is used.
parameters
An argument list for the invoked method or constructor. This is an array of objects with the same number, order, and type as the parameters of the method or constructor to be invoked. If there are no parameters, this should be null.If the method or constructor represented by this instance takes a ByRef parameter, there is no special attribute required for that parameter in order to invoke the method or constructor using this function. Any object in this array that is not explicitly initialized with a value will contain the default value for that object type. For reference-type elements, this value is null. For value-type elements, this value is 0, 0.0, or false, depending on the specific element type.
culture
An instance of CultureInfo used to govern the coercion of types. If this is null, the CultureInfo for the current thread is used. (This is necessary to convert a String that represents 1000 to a Double value, for example, since 1000 is represented differently by different cultures.)

返回值: An Object containing the return value of the invoked method, or null in the case of a constructor, or null if the method's return type is void. Before calling the method or constructor, Invoke checks to see if the user has access permission and verify that the parameters are valid.

IsDefined
public override bool IsDefined(Type attributeType, bool inherit)
result = defaultConstructorInfo.IsDefined(attributeType, inherit)

When overridden in a derived class, indicates whether one or more instance of is applied to this member.

attributeType
The Type object to which the custom attributes are applied.
inherit
Specifies whether to search this member's inheritance chain to find the attributes.

返回值: true if one or more instance of is applied to this member; otherwise false.

ToString
public override string ToString()
result = defaultConstructorInfo.ToString()

Returns a String that represents the current Object.

返回值: A String that represents the current Object.