NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Activator.CreateInstance (Type)

Calling this method is equivalent to calling the constructor on the class with no arguments (the default constructor). For example if the Type object represents the String class, calling CreateInstance() is equivalent to invoking the default String constructor. This would fail, however (a MissingMethodException would be thrown) because String does not have a default constructor.

Note: Access restrictions are ignored for fully trusted code. That is, private constructors, methods, fields, and properties can be accessed and invoked via Reflection whenever the code is fully trusted.

[Visual Basic]
Overloads Public Shared Function CreateInstance( _
   ByVal type As Type _
) As Object
[C#]
public static object CreateInstance(
   Type type
);
[C++]
public: static Object* CreateInstance(
   Type* type
);
[JScript]
public static function CreateInstance(
   type : Type
) : Object;

Parameters

type
The Type designator for the class of object you want to create.

Return Value

A reference to the newly created object.

Exceptions

Exception Type Condition
MissingMethodException If no default constructor exists for the type.

See Also

Activator Class | Activator Members | System Namespace | Activator.CreateInstance Overload List