DotNetObject
Create an instance of a .NET type
WSupported on Windows
|
|
|
|
object = new DotNetObject(assembly, type[, arg ...]])
Arguments
object
The returned object instance (@DotNetObject).
assembly
The assembly in which this component is found.
type
An alphanumeric fully qualified type name, which includes the type’s namespace but not its assembly name.
arg
(optional) One or more constructor arguments.
Discussion
A constructor for the specified type will be invoked based upon the arg arguments passed. See DotNetObject.Call for a description of how arguments are converted to .NET types.
To directly load a System type (for example, System.String) using this API, the corresponding .NET assembly must be loaded in order to retrieve a DotNetAssembly object that corresponds to it, even though this system assembly was already loaded automatically when the CLR was loaded. The search for type is case-sensitive.
If the type cannot be found in the specified assembly or it is not public, an $ERR_MISSFLD error will occur.
Examples
The example below initializes a new instance of System.Windows.Forms.Form. See Sample programs for an example in the context of a complete program.
form = new DotNeObject(asm, "System.Windows.Forms.Form")