ClearScript Library
ClearScript Library
ClearScript Library Reference
Microsoft.ClearScript
HostFunctions Class
HostFunctions Constructor
HostFunctions Methods

# HostFunctions Class

Provides optional script-callable utility functions.
Inheritance Hierarchy
SystemObject
Microsoft.ClearScriptHostFunctions
Microsoft.ClearScriptExtendedHostFunctions
Namespace: Microsoft.ClearScript
Assembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.5.0
Syntax
C#
VB
C++
F#
Copy

    public class HostFunctions : IScriptableObject

    Public Class HostFunctions
    	Implements IScriptableObject

    public ref class HostFunctions : IScriptableObject

    type HostFunctions =
        class
            interface IScriptableObject
        end

The HostFunctions type exposes the following members.

Constructors

| Name | Description
--- | --- | ---
| HostFunctions | Initializes a new HostFunctions instance.

Top
Methods

| Name | Description
--- | --- | ---
| asTypeT | Casts an object to the specified host type, returning null if the cast fails.
| castT | Casts an object to the specified host type.
| delT | Creates a delegate that invokes a script function.
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object)
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object)
| flagsT | Creates a strongly typed flag set.
| func(Int32, Object) | Creates a delegate that invokes a script function and returns its result value.
| funcT(Int32, Object) | Creates a delegate that invokes a script function and returns a value of the specified type.
| getElement | Gets the value of an element in a dynamic host object that implements IDynamicMetaObjectProvider.
| GetHashCode | Serves as the default hash function. (Inherited from Object)
| getProperty(IDynamicMetaObjectProvider, String) | Gets the value of a property in a dynamic host object that implements IDynamicMetaObjectProvider.
| getProperty(IPropertyBag, String) | Gets the value of a property in a dynamic host object that implements IPropertyBag.
| GetType | Gets the Type of the current instance. (Inherited from Object)
| isNull | Determines whether the specified value is null.
| isTypeT | Determines whether an object is compatible with the specified host type.
| isTypeObj(Object) | Determines whether an object is a host type. This version is invoked if the specified object cannot be used as a type argument.
| isTypeObjT | Determines whether an object is a host type. This version is invoked if the specified object can be used as a type argument.
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object)
| newArr(Int32) | Creates a host array with Object as the element type.
| newArrT(Int32) | Creates a host array with the specified element type.
| newObj | Creates an empty host object.
| newObj(IDynamicMetaObjectProvider, Object) | Performs dynamic instantiation.
| newObj(Object, Object) | Creates a host object of the specified type. This version is invoked if the specified type cannot be used as a type argument.
| newObjT(Object) | Creates a host object of the specified type. This version is invoked if the specified type can be used as a type argument.
| newVarT | Creates a host variable of the specified type.
| proc | Creates a delegate that invokes a script function and returns no value.
| removeElement | Removes an element from a dynamic host object that implements IDynamicMetaObjectProvider.
| removeProperty(IDynamicMetaObjectProvider, String) | Removes a property from a dynamic host object that implements IDynamicMetaObjectProvider.
| removeProperty(IPropertyBag, String) | Removes a property from a dynamic host object that implements IPropertyBag.
| setElement | Sets an element value in a dynamic host object that implements IDynamicMetaObjectProvider.
| setProperty(IDynamicMetaObjectProvider, String, Object) | Sets a property value in a dynamic host object that implements IDynamicMetaObjectProvider.
| setProperty(IPropertyBag, String, Object) | Sets a property value in a dynamic host object that implements IPropertyBag.
| toByte | Converts the specified value to a strongly typed Byte instance.
| toChar | Converts the specified value to a strongly typed Char instance.
| toDecimal | Converts the specified value to a strongly typed Decimal instance.
| toDouble | Converts the specified value to a strongly typed Double instance.
| toInt16 | Converts the specified value to a strongly typed Int16 instance.
| toInt32 | Converts the specified value to a strongly typed Int32 instance.
| toInt64 | Converts the specified value to a strongly typed Int64 instance.
| toSByte | Converts the specified value to a strongly typed SByte instance.
| toSingle | Converts the specified value to a strongly typed Single instance.
| toStaticType | Casts a dynamic host object to its static type.
| ToString | Returns a string that represents the current object. (Inherited from Object)
| toUInt16 | Converts the specified value to a strongly typed UInt16 instance.
| toUInt32 | Converts the specified value to a strongly typed UInt32 instance.
| toUInt64 | Converts the specified value to a strongly typed UInt64 instance.
| tryCatch | Allows script code to handle host exceptions.
| typeOf(Object) | Gets the Type for the specified host type. This version is invoked if the specified object cannot be used as a type argument.
| typeOfT | Gets the Type for the specified host type. This version is invoked if the specified object can be used as a type argument.

Top
Remarks
Use AddHostObject to expose a HostFunctions instance to script code. Each instance can only be exposed in one script engine.
See Also

#### Reference

Microsoft.ClearScript Namespace

Copyright © Microsoft Corporation. All rights reserved.

Send comments on this topic to Microsoft