EnforceType Function (Usual, DWord) | |
Make sure a variable is of a certain type.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION EnforceType(
u AS USUAL,
dwType AS DWORD
) AS VOID
public static void EnforceType(
Usual u,
uint dwType
)
Request Example
View SourceParameters
- u
- Type: Usual
The variable to check.
If u is NIL and is passed by reference, the EmptyUsual() of the
data type specified by dwType is assigned to it.
If u is not passed by reference and is not of the
data type specified by dwType, the error system aborts the program.
If u is passed by reference but
is not of the data type specified by dwType, the error system is called up and the EmptyUsual() of the data type
specified by dwType is assigned to u.
- dwType
- Type: DWord
The data type to enforce.
Return Value
Type:
Remarks Examples
This example uses EnforceType() to ensure all arguments are of the correct type:
1FUNCTION CheckArgs(cName, nScore, dDate, nMoney)
2 EnforceType(@cName, STRING)
3 EnforceType(@nScore, SHORTINT)
4
5 EnforceType(@dDate, DATE)
6 EnforceType(@nMoney, LONGINT)
7 EnforceType(@nOne, SHORTINT)
See Also