ClearScript Library
ClearScript Library
ClearScript Library Reference
Microsoft.ClearScript
ScriptEngine Class
ScriptEngine Methods
AddRestrictedHostObject Method
AddRestrictedHostObject<T>(String, T) Method
AddRestrictedHostObject<T>(String, HostItemFlags, T) Method

# ScriptEngineAddRestrictedHostObject T(String, HostItemFlags, T) Method

Exposes a host object to script code with the specified type restriction and options.
Namespace: Microsoft.ClearScript
Assembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.5.0
Syntax
C#
VB
C++
F#
Copy

    public void AddRestrictedHostObject<T>(
    	string itemName,
    	HostItemFlags flags,
    	T target
    )

    Public Sub AddRestrictedHostObject(Of T) (
    	itemName As String,
    	flags As HostItemFlags,
    	target As T
    )

    public:
    generic<typename T>
    virtual void AddRestrictedHostObject(
    	String^ itemName,
    	HostItemFlags flags,
    	T target
    ) sealed

    abstract AddRestrictedHostObject :
            itemName : string *
            flags : HostItemFlags *
            target : 'T -> unit
    override AddRestrictedHostObject :
            itemName : string *
            flags : HostItemFlags *
            target : 'T -> unit

#### Parameters

itemName String
  A name for the new global script item that will represent the object.
flags HostItemFlags
  A value that selects options for the operation.
target T
  The object to expose.

#### Type Parameters

T
  The type whose members are to be made accessible from script code.

#### Implements

IScriptEngineAddRestrictedHostObjectT(String, HostItemFlags, T)
Remarks

This method can be used to restrict script access to the members of a particular interface or base class.

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

See Also

#### Reference

ScriptEngine Class
AddRestrictedHostObject Overload
Microsoft.ClearScript Namespace

Copyright © Microsoft Corporation. All rights reserved.

Send comments on this topic to Microsoft