ClearScript Library
ClearScript Library
ClearScript Library Reference
Microsoft.ClearScript
ScriptEngine Class
ScriptEngine Methods
AddHostObject Method
AddHostObject(String, Object) Method
AddHostObject(String, HostItemFlags, Object) Method

# ScriptEngineAddHostObject(String, Object) Method

Exposes a host object to script code.
Namespace: Microsoft.ClearScript
Assembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.5.0
Syntax
C#
VB
C++
F#
Copy

    public void AddHostObject(
    	string itemName,
    	Object target
    )

    Public Sub AddHostObject (
    	itemName As String,
    	target As Object
    )

    public:
    virtual void AddHostObject(
    	String^ itemName,
    	Object^ target
    ) sealed

    abstract AddHostObject :
            itemName : string *
            target : Object -> unit
    override AddHostObject :
            itemName : string *
            target : Object -> unit

#### Parameters

itemName String
  A name for the new global script item that will represent the object.
target Object
  The object to expose.

#### Implements

IScriptEngineAddHostObject(String, Object)
Remarks
For information about the mapping between host members and script-callable properties and methods, see AddHostObject(String, HostItemFlags, Object).
See Also

#### Reference

ScriptEngine Class
AddHostObject Overload
Microsoft.ClearScript Namespace

Copyright © Microsoft Corporation. All rights reserved.

Send comments on this topic to Microsoft