Click or drag to resize

HostFunctionsisTypeT Method

Determines whether an object is compatible with the specified host type.

Namespace: Microsoft.ClearScript
Assembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.4.5
Syntax
public bool isType<T>(
	Object value
)

Parameters

value  Object
The object to test for compatibility with the specified host type.

Type Parameters

T
The host type with which to test value for compatibility.

Return Value

Boolean
True if value is compatible with the specified type, false otherwise.
Remarks
This function is similar to C#'s is operator.
Example
The following code defines a function that determines whether an object implements IComparable. It assumes that an instance of ExtendedHostFunctions is exposed under the name "host" (see AddHostObject).
JavaScript
function isComparable(value)
{
    var IComparableT = host.type("System.IComparable");
    return host.isType(IComparableT, value);
}
See Also