HostFunctionstoInt16 Method | 
            Converts the specified value to a strongly typed 
Int16 instance.
            
 Namespace: Microsoft.ClearScriptAssembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.5.0
Syntaxpublic Object toInt16(
	IConvertible value
)
Public Function toInt16 ( 
	value As IConvertible
) As Object
public:
Object^ toInt16(
	IConvertible^ value
)
member toInt16 : 
        value : IConvertible -> Object Parameters
- value  IConvertible
 - The value to convert.
 
Return Value
ObjectAn object that can be passed to a parameter of type 
Int16.
Remarks
            This function converts 
value to 
Int16 and
            packages the result to retain its numeric type across the host-script boundary. It may
            be useful for passing arguments to 
Int16 parameters if the script
            engine does not support that type natively.
            
Example
            The following code adds an element of type 
Int16 to a strongly
            typed list.
            It assumes that an instance of 
ExtendedHostFunctions is exposed under
            the name "host"
            (see 
AddHostObject).
            
var ElementT = host.type("System.Int16");
var ListT = host.type("System.Collections.Generic.List", ElementT);
var list = host.newObj(ListT);
list.Add(host.toInt16(42));
See Also