DynamicCast()

System::DynamicCast(const TFrom&) function

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)

Template parameters

ParameterDescription
TToTarget Exception type.
TFromSource Exception type.

Arguments

ParameterTypeDescription
objconst TFrom&Source pointer.

Return Value

Cast result if cast is allowed.

Deprecated
Left for backwards compatibility. Use ExplicitCast instead.

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

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)

Template parameters

ParameterDescription
TToTarget pointee type.
TFromSource pointee type.

Arguments

ParameterTypeDescription
objSmartPtr<TFrom> const&Source pointer.

Return Value

Cast result if cast is allowed.

Deprecated
Left for backwards compatibility. Use ExplicitCast instead.

System::DynamicCast(SmartPtr<TFrom>) function

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)

Template parameters

ParameterDescription
TToTarget enum type.
TFromSource pointee type.

Arguments

ParameterTypeDescription
objSmartPtr<TFrom>Pointer to the object to unbox data from.

Return Value

Unboxed enum value.

Deprecated
Left for backwards compatibility. Use ExplicitCast instead.

System::DynamicCast(std::nullptr_t) function

Performs dynamic cast of null objects.

template<typename TTo> CastResult<TTo>::type System::DynamicCast(std::nullptr_t) noexcept

Template parameters

ParameterDescription
TToTarget pointee type.

Return Value

nullptr.

Deprecated
Left for backwards compatibility. Use ExplicitCast instead.

System::DynamicCast(TFrom&) function

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)

Template parameters

ParameterDescription
TToTarget type.
TFromSource type.

Arguments

ParameterTypeDescription
objTFrom&Source object.

Return Value

Cast result.

Deprecated
Left for backwards compatibility. Use ExplicitCast instead.

System::DynamicCast(SmartPtr<TFrom>) function

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)

Template parameters

ParameterDescription
TToTarget Exception type.
TFromObject type.

Arguments

ParameterTypeDescription
objSmartPtr<TFrom>Source pointer.

Return Value

Cast result if cast is allowed.

Deprecated
Left for backwards compatibility. Use ExplicitCast instead.

System::DynamicCast(TFrom) function

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

Template parameters

ParameterDescription
TToTarget type.
TFromSource type.

Arguments

ParameterTypeDescription
valueTFromSource IntPtr value.

Return Value

Cast result.

Deprecated
Left for backwards compatibility. Use ExplicitCast instead.

See Also