Click or drag to resize

HostFunctionsnewObj Method

Creates an empty host object.

Namespace: Microsoft.ClearScript
Assembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.4.5
public PropertyBag newObj()

Return Value

A new empty host object.
This function is provided for script languages that do not support external instantiation. It creates an object that supports dynamic property addition and removal. The host can manipulate it via the IPropertyBag interface.
The following code creates an empty host object and adds several properties to it. It assumes that an instance of HostFunctions is exposed under the name "host" (see AddHostObject).
var item = host.newObj();
item.label = "Widget";
item.weight = 123.45;
See Also