ClearScript Library
ClearScript Library
ClearScript Library Reference
Microsoft.ClearScript
Extensions Class
Extensions Methods
ToRestrictedHostObject Method
ToRestrictedHostObject<T>(T) Method
ToRestrictedHostObject(Object, Type) Method
ToRestrictedHostObject<T>(T, ScriptEngine) Method
ToRestrictedHostObject(Object, Type, ScriptEngine) Method

# ExtensionsToRestrictedHostObject(Object, Type, ScriptEngine) Method

Converts an object to a host object with a type restriction specified as a Type instance, for use with script code running in the specified script engine.
Namespace: Microsoft.ClearScript
Assembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.5.0
Syntax
C#
VB
C++
F#
Copy

    public static Object ToRestrictedHostObject(
    	this Object target,
    	Type type,
    	ScriptEngine engine
    )

    <ExtensionAttribute>
    Public Shared Function ToRestrictedHostObject (
    	target As Object,
    	type As Type,
    	engine As ScriptEngine
    ) As Object

    public:
    [ExtensionAttribute]
    static Object^ ToRestrictedHostObject(
    	Object^ target,
    	Type^ type,
    	ScriptEngine^ engine
    )

    [<ExtensionAttribute>]
    static member ToRestrictedHostObject :
            target : Object *
            type : Type *
            engine : ScriptEngine -> Object

#### Parameters

target Object
  The object to convert to a host object for use with script code.
type Type
  The type whose members are to be made accessible from script code.
engine ScriptEngine
  The script engine in which the host object will be used.

#### Return Value

Object
A host object with the specified type restriction.

#### Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Object. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

#### Reference

Extensions Class
ToRestrictedHostObject Overload
Microsoft.ClearScript Namespace

Copyright © Microsoft Corporation. All rights reserved.

Send comments on this topic to Microsoft