System::DynamicCast method

System::DynamicCast(const TFrom&) method

Performs dynamic cast on Exception objects.

template<typename TTo,typename TFrom> std::enable_if<IsExceptionWrapper<TFrom>::value &&IsExceptionWrapper<TTo>::value &&(std::is_convertible<TTo, TFrom>::value||std::is_base_of<TTo, TFrom>::value), TTo>::type System::DynamicCast(const TFrom &obj)
ParameterDescription
TToTarget Exception type.
TFromSource Exception type.
ParameterTypeDescription
objconst TFrom&Source pointer.

ReturnValue

Cast result if cast is allowed.

Deprecated

Left for backwards compatibility. Use ExplicitCast instead.

See Also

System::DynamicCast(SmartPtr<TFrom> const&) method

Performs dynamic cast on SmartPtr objects.

template<typename TTo,typename TFrom> std::enable_if<!std::is_enum<TTo>::value &&!IsExceptionWrapper<TTo>::value, typenameCastResult<TTo>::type>::type System::DynamicCast(SmartPtr<TFrom> const &obj)
ParameterDescription
TToTarget pointee type.
TFromSource pointee type.
ParameterTypeDescription
objSmartPtr<TFrom> const&Source pointer.

ReturnValue

Cast result if cast is allowed.

Deprecated

Left for backwards compatibility. Use ExplicitCast instead.

See Also

System::DynamicCast(SmartPtr<TFrom>) method

Unboxes boxed enum via cast.

template<typename TTo,typename TFrom> std::enable_if<std::is_enum<TTo>::value, TTo>::type System::DynamicCast(SmartPtr<TFrom> obj)
ParameterDescription
TToTarget enum type.
TFromSource pointee type.
ParameterTypeDescription
objSmartPtr<TFrom>Pointer to the object to unbox data from.

ReturnValue

Unboxed enum value.

Deprecated

Left for backwards compatibility. Use ExplicitCast instead.

See Also

System::DynamicCast(SmartPtr<TFrom>) method

Performs dynamic cast on Objects to Exception objects.

template<typename TTo,typename TFrom> std::enable_if<std::is_same<System::Object, TFrom>::value &&IsExceptionWrapper<TTo>::value, TTo>::type System::DynamicCast(SmartPtr<TFrom> obj)
ParameterDescription
TToTarget Exception type.
TFromObject type.
ParameterTypeDescription
objSmartPtr<TFrom>Source pointer.

ReturnValue

Cast result if cast is allowed.

Deprecated

Left for backwards compatibility. Use ExplicitCast instead.

See Also

System::DynamicCast(std::nullptr_t) method

Performs dynamic cast of null objects.

template<typename TTo> CastResult<TTo>::type System::DynamicCast(std::nullptr_t) noexcept
ParameterDescription
TToTarget pointee type.

ReturnValue

nullptr.

Deprecated

Left for backwards compatibility. Use ExplicitCast instead.

See Also

System::DynamicCast(TFrom&) method

Performs dynamic cast on non-pointer objects.

template<typename TTo,typename TFrom> std::enable_if<!IsExceptionWrapper<TFrom>::value &&!IsSmartPtr<TFrom>::value &&std::is_convertible<TTo, TFrom>::value, TTo>::type System::DynamicCast(TFrom &obj)
ParameterDescription
TToTarget type.
TFromSource type.
ParameterTypeDescription
objTFrom&Source object.

ReturnValue

Cast result.

Deprecated

Left for backwards compatibility. Use ExplicitCast instead.

See Also

System::DynamicCast(TFrom) method

Performs dynamic cast from IntPtr to pointer.

template<typename TTo,typename TFrom> std::enable_if<std::is_pointer<TTo>::value &&std::is_same<IntPtr, TFrom>::value, TTo>::type System::DynamicCast(TFrom value) noexcept
ParameterDescription
TToTarget type.
TFromSource type.
ParameterTypeDescription
valueTFromSource IntPtr value.

ReturnValue

Cast result.

Deprecated

Left for backwards compatibility. Use ExplicitCast instead.

See Also