Sitecore 5.0 API

MainUtil.CreateObject Method (Type, Object[])

Creates an instance of an object.

[Visual Basic]
Overloads Public Shared Function CreateObject( _
   ByVal type As Type, _
   ByVal parameters As Object() _
) As Object
[C#]
public static object CreateObject(
   Type type,
   object[] parameters
);

Parameters

type
Name of both assembly and class of the object.
parameters
Parameters.

Return Value

The instantiated object or null if the object could not be instantiated.

Remarks

If the object could not be instantiated, an error message is written to the log file (usually located in the data folder).

Example

  object MyObject = MainUtil.CreateObject("MyAssembly.MyObject", parameter1, parameter2);

See Also

MainUtil Class | Sitecore Namespace | MainUtil.CreateObject Overload List