Safe downcasting
The as
operator returns null
when a dynamic cast fails. You can use it combined with IsDefined
to perform safe downcasts. The following example shows how you can safe downcast a VehicleObject to a WheeledObject, a CarObject or a BikeObject:
Last updated
Was this helpful?