Creates an instance of the specified type using the constructor that best matches the specified parameters.
- type
- The type of object to create.
- bindingAttr
- A combination of zero or more bit flags that affect the search for the type constructor. If bindingAttr is zero, a case-sensitive search for public constructors is conducted.
- binder
- An object that uses bindingAttr and args to seek and identify the type constructor. If binder is null, the default binder is used.
- args
- An array of arguments that match in number, order, and type the parameters of the constructor to invoke. If args is an empty array or null, the constructor that takes no parameters (the default constructor) is invoked.
- culture
- Culture-specific information that governs the coercion of args to the formal types declared for the type constructor. If culture is null, the System.Globalization.CultureInfo for the current thread is used.
A reference to the newly created object.
The constructor to be invoked must provide the most specific match with the specified argument list under the constraints of the specified binder and binding attributes.
Starting with the net_v20sp1_long, this method can be used to access nonpublic types and members if the caller has been granted System.Security.Permissions.ReflectionPermission with the System.Security.Permissions.ReflectionPermissionFlag.RestrictedMemberAccess flag and if the grant set of the assembly that contains the nonpublic types and members is restricted to the caller’s grant set or to a subset thereof. (See Security Considerations for Reflection.)
To use this functionality, your application should target the net_v35_long or later.