downcast

Casts an object of one class to another class. Using this function is safer than a plain cast, as it also statically ensures that the variable being cast from is a class or an interface.

To
downcast
(
To
From
)
(
From value
)

Parameters

To

type to cast to (must be a class)

From

type to cast from (must be a class or interface)

value From

object to be cast to type To

Return Value

Type: To

input parameter cast to type To. The returned object may be null if the From cannot be downcast to To

Meta