Click or drag to resize

HostFunctionstoUInt32 Method

Converts the specified value to a strongly typed UInt32 instance.

Namespace: Microsoft.ClearScript
Assembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.4.5
Syntax
public Object toUInt32(
	IConvertible value
)

Parameters

value  IConvertible
The value to convert.

Return Value

Object
An object that can be passed to a parameter of type UInt32.
Remarks
This function converts value to UInt32 and packages the result to retain its numeric type across the host-script boundary. It may be useful for passing arguments to UInt32 parameters if the script engine does not support that type natively.
Example
The following code adds an element of type UInt32 to a strongly typed list. It assumes that an instance of ExtendedHostFunctions is exposed under the name "host" (see AddHostObject).
JavaScript
// import types
var ElementT = host.type("System.UInt32");
var ListT = host.type("System.Collections.Generic.List", ElementT);
// create a list
var list = host.newObj(ListT);
// add a list element
list.Add(host.toUInt32(42));
See Also