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
Syntax
public PropertyBag newObj()

Return Value

PropertyBag
A new empty host object.
Remarks
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.
Example
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).
JavaScript
var item = host.newObj();
item.label = "Widget";
item.weight = 123.45;
See Also