Contains methods to create types of objects locally or remotely, or obtain references to existing remote objects. This class cannot be inherited.
See Also: Activator Members
The Activator.CreateInstance(Type, System.Reflection.BindingFlags, System.Reflection.Binder, Object, System.Globalization.CultureInfo) method creates an instance of a type defined in an assembly by invoking the constructor that best matches the specified arguments. If no arguments are specified, the constructor that takes no parameters, that is, the default constructor, is invoked.
You must have sufficient permission to search for and call a constructor; otherwise, an exception is thrown. By default, only public constructors are considered during the search for a constructor. If no constructor or default constructor can be found, an exception is thrown.
A binder parameter specifies an object that searches an assembly for a suitable constructor. You can specify your own binder and search criteria. If no binder is specified, a default binder is used. For more information, see the System.Reflection.Binder and System.Reflection.BindingFlags classes.
An evidence parameter affects the security policy and permissions for the constructor. For more information, see the System.Security.Policy.Evidence class.
An instance of a type can be created at a local or remote site. If the type is created remotely, an activation attribute parameter specifies the URI of the remote site. The call to create the instance might pass through intermediary sites before it reaches the remote site. Other activation attributes can modify the environment, or context, in which the call operates at the remote and intermediary sites.
If the instance is created locally, a reference to that object is returned. If the instance is created remotely, a reference to a proxy is returned. The remote object is manipulated through the proxy as if it were a local object.
The Activator.GetObject(Type, string) method creates a proxy to a currently running remote object, server-activated well-known object, or XML Web service. You can specify the connection medium, that is, the channel. For more information, see the System.Runtime.Remoting.Channels.ChannelServices class.
Assemblies contain type definitions. The Activator.CreateInstance(Type, System.Reflection.BindingFlags, System.Reflection.Binder, Object, System.Globalization.CultureInfo) method creates an instance of a type from a currently running assembly. The Activator.CreateInstanceFrom(string, string) method creates an instance from a file that contains an assembly. The Activator.CreateComInstanceFrom(string, string) method creates an instance of a COM object from a file that contains an assembly.