ClearScript Library
ClearScript Library
ClearScript Library Reference
Microsoft.ClearScript
HostFunctions Class
HostFunctions Methods
newObj Method
newObj Method
newObj<T>(Object[]) Method
newObj(IDynamicMetaObjectProvider, Object[]) Method
newObj(Object, Object[]) Method

# HostFunctionsnewObj Method

Creates an empty host object.
Namespace: Microsoft.ClearScript
Assembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.5.0
Syntax
C#
VB
C++
F#
Copy

    public PropertyBag newObj()

    Public Function newObj As PropertyBag

    public:
    PropertyBag^ newObj()

    member newObj : unit -> PropertyBag

#### 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
Copy

    var item = host.newObj();
    item.label = "Widget";
    item.weight = 123.45;

See Also

#### Reference

HostFunctions Class
newObj Overload
Microsoft.ClearScript Namespace

Copyright © Microsoft Corporation. All rights reserved.

Send comments on this topic to Microsoft