HostFunctionstoByte Method |
Converts the specified value to a strongly typed
Byte instance.
Namespace:
Microsoft.ClearScript
Assembly:
ClearScript.Core (in ClearScript.Core.dll) Version: 7.3.1
Syntaxpublic Object toByte(
IConvertible value
)
Public Function toByte (
value As IConvertible
) As Object
public:
Object^ toByte(
IConvertible^ value
)
member toByte :
value : IConvertible -> Object
Parameters
- value
- Type: SystemIConvertible
The value to convert.
Return Value
Type:
ObjectAn object that can be passed to a parameter of type
Byte.
Remarks
This function converts
value to
Byte and
packages the result to retain its numeric type across the host-script boundary. It may
be useful for passing arguments to
Byte parameters if the script
engine does not support that type natively.
Examples
The following code adds an element of type
Byte 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.Byte");
var ListT = host.type("System.Collections.Generic.List", ElementT);
var list = host.newObj(ListT);
list.Add(host.toByte(42));
See Also