Type conversions enable the user to use values of one type as values of another type. Type conversions can be explicit or implicit, the difference is in using type conversion operations.To check if one type can be converted to another one and if explicit conversion is available in the Fore.NET language, use the Is and As operators respectively. Implicit conversion is executed on assigning a compatible type or a type that inherits from the source variable type.
The Is operator is used to check if the runtime type of an object is compatible with a given type. The E Is T operator, where E is an expression and T is a type, results in a logical value indicating whether E can be successfully converted to type T by explicit or implicit conversion.
The As operator is used to explicitly convert a value to a given type. In an operation of the form E As T, E must be an expression and T must be a type. The result type is always T and is classified as a value.
See also: