ClearScript Library
ClearScript Library
ClearScript Library Reference
Microsoft.ClearScript
ScriptEngine Class
ScriptEngine Methods
AddHostType Method
AddHostType(Type) Method
AddHostType(HostItemFlags, Type) Method
AddHostType(String, Type) Method
AddHostType(String, HostItemFlags, Type) Method
AddHostType(String, String, Type[]) Method
AddHostType(String, HostItemFlags, String, Type[]) Method
AddHostType(String, String, String, Type[]) Method
AddHostType(String, HostItemFlags, String, String, Type[]) Method

# ScriptEngineAddHostType(String, Type) Method

Exposes a host type 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 AddHostType(
    	string itemName,
    	Type type
    )

    Public Sub AddHostType (
    	itemName As String,
    	type As Type
    )

    public:
    virtual void AddHostType(
    	String^ itemName,
    	Type^ type
    ) sealed

    abstract AddHostType :
            itemName : string *
            type : Type -> unit
    override AddHostType :
            itemName : string *
            type : Type -> unit

#### Parameters

itemName String
  A name for the new global script item that will represent the type.
type Type
  The type to expose.

#### Implements

IScriptEngineAddHostType(String, Type)
Remarks

Host types are exposed to script code in the form of objects whose properties and methods are bound to the type's static members and nested types. If the type has generic parameters, the corresponding object will be invocable with type arguments to yield a specific type.

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

See Also

#### Reference

ScriptEngine Class
AddHostType Overload
Microsoft.ClearScript Namespace

Copyright © Microsoft Corporation. All rights reserved.

Send comments on this topic to Microsoft