Script |
In some script languages the distinction between statements and expressions is significant but ambiguous for certain syntactic elements. This method always interprets the specified script code as an expression.
If a debugger is attached, it will present the specified script code to the user as a document with the specified name. Discarding this document removes it from view but has no effect on the script engine. Only Windows Script engines honor discard.
The following table summarizes the types of result values that script code can return.
Type | Returned As | Remarks |
---|---|---|
String | System.String | N/A |
Boolean | System.Boolean | N/A |
Number | System.Int32 or System.Double | Other numeric types are possible. The exact conversions between script and .NET numeric types are defined by the script engine. |
Null Reference | null | N/A |
Undefined | Undefined | This represents JavaScript's undefined, VBScript's Empty, etc. |
Void | VoidResult | This is returned when script code forwards the result of a host method that returns no value. |
Host Object | Native .NET type | This includes all .NET types not mentioned above, including value types (enums, structs, etc.), and instances of all other classes. Script code can only create these objects by invoking a host method or constructor. They are returned to the host in their native .NET form. |
Script Object | ScriptObject | This includes all native script objects that have no .NET representation. C#'s dynamic keyword provides a convenient way to access them. |
Other | Unspecified | This includes host types and other ClearScript-specific objects intended for script code use only. It may also include language-specific values that the ClearScript library does not support. |