Box()

ObjectExt::Box(const T&) method

Boxes value types for converting to Object. Implementation for enum types.

template<typename T> static std::enable_if<std::is_enum<T>::value, System::SmartPtr<System::Object>>::type System::ObjectExt::Box(const T &value)

Template parameters

ParameterDescription
TEnum type.

Arguments

ParameterTypeDescription
valueconst T&Enum value to box.

Return Value

Smart pointer to object keeping boxed value.

ObjectExt::Box(const T&) method

Boxes value types for converting to Object. Implementation for non-enum types.

template<typename T> static std::enable_if<!std::is_enum<T>::value &&!IsNullable<T>::value, System::SmartPtr<System::Object>>::type System::ObjectExt::Box(const T &value)

Template parameters

ParameterDescription
TValue type.

Arguments

ParameterTypeDescription
valueconst T&Value to box.

Return Value

Smart pointer to object keeping boxed value.

ObjectExt::Box(const T&) method

Boxes Nullable types for converting to Object.

template<typename T> static std::enable_if<IsNullable<T>::value, System::SmartPtr<System::Object>>::type System::ObjectExt::Box(const T &value)

Template parameters

ParameterDescription
TValue type.

Arguments

ParameterTypeDescription
valueconst T&Value to box.

Return Value

Smart pointer to object keeping boxed value.

ObjectExt::Box(const String&) method

Boxes string values.

SmartPtr<Object> System::ObjectExt::Box(const String &value)

Arguments

ParameterTypeDescription
valueconst String&Value to box.

Return Value

Boxed value or null, if source string is null.

See Also