Cast()

System::Collections::Generic::Details::CastRules::Cast(Source) function

Casts the source type to the result type. Used when the source and the result types are the same.

template<typename Source,typename Result> std::enable_if_t<CastType<Source, Result>::None, Result> System::Collections::Generic::Details::CastRules::Cast(Source value)

Template parameters

ParameterDescription
SourceThe source type.
ResultThe result type.

Return Value

The cast result.

System::Collections::Generic::Details::CastRules::Cast(Source) function

Casts the source type to the result type. Used when the source type can be statically cast to the result type.

template<typename Source,typename Result> std::enable_if_t<CastType<Source, Result>::Static, Result> System::Collections::Generic::Details::CastRules::Cast(Source value)

Template parameters

ParameterDescription
SourceThe source type.
ResultThe result type.

Return Value

The cast result.

System::Collections::Generic::Details::CastRules::Cast(Source) function

Casts the source type to the result type. Used when the types aren’t the same and the source type cannot be statically cast to the result type.

template<typename Source,typename Result> std::enable_if_t<CastType<Source, Result>::Dynamic, Result> System::Collections::Generic::Details::CastRules::Cast(Source value)

Template parameters

ParameterDescription
SourceThe source type.
ResultThe result type.

Return Value

The cast result.

System::Collections::Generic::Details::CastRules::Cast(Source) function

Casts the source type to the result type. Used when the source type is being boxed to the Nullable class instance.

template<typename Source,typename Result> std::enable_if_t<CastType<Source, Result>::NullableBoxing, Result> System::Collections::Generic::Details::CastRules::Cast(Source value)

Template parameters

ParameterDescription
SourceThe source type.
ResultThe result type.

Return Value

The cast result.

System::Collections::Generic::Details::CastRules::Cast(Source) function

Casts the source type to the result type. Used when the source type is being unboxed from the Nullable class instance.

template<typename Source,typename Result> std::enable_if_t<CastType<Source, Result>::NullableUnboxing, Result> System::Collections::Generic::Details::CastRules::Cast(Source value)

Template parameters

ParameterDescription
SourceThe source type.
ResultThe result type.

Return Value

The cast result.

System::Collections::Generic::Details::CastRules::Cast(Source) function

Casts the source type to the result type. Used when the source type is being boxed to the Object class instance.

template<typename Source,typename Result> std::enable_if_t<CastType<Source, Result>::Boxing, Result> System::Collections::Generic::Details::CastRules::Cast(Source value)

Template parameters

ParameterDescription
SourceThe source type.
ResultThe result type.

Return Value

The cast result.

System::Collections::Generic::Details::CastRules::Cast(Source) function

Casts the source type to the result type. Used when the source type is being unboxed from the Object class instance.

template<typename Source,typename Result> std::enable_if_t<CastType<Source, Result>::Unboxing, Result> System::Collections::Generic::Details::CastRules::Cast(Source value)

Template parameters

ParameterDescription
SourceThe source type.
ResultThe result type.

Return Value

The cast result.

System::Collections::Generic::Details::CastRules::Cast(Source) function

Casts the source type to the result type. Used when the casting is invalid or the conversion is explicit.

template<typename Source,typename Result> std::enable_if_t<CastType<Source, Result>::Invalid, Result> System::Collections::Generic::Details::CastRules::Cast(Source)

Template parameters

ParameterDescription
SourceThe source type.
ResultThe result type.

Return Value

The cast result.

See Also