| title | Platform::Box Class | Microsoft Docs | |
|---|---|---|
| ms.custom | ||
| ms.date | 12/30/2016 | |
| ms.prod | windows-client-threshold | |
| ms.technology | cpp-windows | |
| ms.reviewer | ||
| ms.suite | ||
| ms.tgt_pltfrm | ||
| ms.topic | language-reference | |
| f1_keywords |
|
|
| dev_langs |
|
|
| ms.assetid | b3d7ea37-e98a-4fbc-80b0-ad35e50250c6 | |
| caps.latest.revision | 7 | |
| author | ghogen | |
| ms.author | ghogen | |
| manager | ghogen |
Enables a value type such as Windows::Foundation::DateTime or a scalar type such as int to be stored in a Platform::Object type. It is usually not necessary to use Box explicitly because boxing happens implicitly when you cast a value type to Object^.
ref class Box abstract; Header: vccorlib.h
Namespace: Platform
| Member | Description |
|---|---|
| Box | Creates a Box that can encapsulate a value of the specified type. |
| operator Box<const T>^ | Enables boxing conversions from a const value class T or enum class T to Box<T>. |
| operator Box<const volatile T>^ | Enables boxing conversions from a const volatile value class T or enum type T to Box<T>. |
| operator Box<T>^ | Enables boxing conversions from a value class T to Box<T>. |
| operator Box<volatile T>^ | Enables boxing conversions from a volatile value class T or enum type T to Box<T>. |
| Box::operator T | Enables boxing conversions from a value class T or enum class T to Box<T>. |
Creates a Box that can encapsulate a value of the specified type.|
|Value property|Returns the value that is encapsulated in the Box object.|
Box(T valueArg); valueArg
The type of value to be boxed—for example, int, bool, float64, DateTime.
Enables boxing conversions from a const value class T or enum class T to Box<T>.
operator Box<const T>^(const T valueType); T
Any value class, value struct, or enum type. Includes the built-in types in the default namespace.
A Platform::Box<T>^ instance that represents the original value boxed in a ref class.
Enables boxing conversions from a const volatile value class T or enum type T to Box<T>.
operator Box<const volatile T>^(const volatile T valueType); T
Any enum type, value class, or value struct. Includes the built-in types in the default namespace.
A Platform::Box<T>^ instance that represents the original value boxed in a ref class.
Enables boxing conversions from a value class T to Box<T>.
operator Box<const T>^(const T valueType); T
Any enum type, value class, or value struct. Includes the built-in types in the default namespace.
A Platform::Box<T>^ instance that represents the original value boxed in a ref class.
Enables boxing conversions from a volatile value class T or enum type T to Box<T>.
operator Box<volatile T>^(volatile T valueType); T
Any enum type, value class, or value struct. Includes the built-in types in the default namespace.
A Platform::Box<T>^ instance that represents the original value boxed in a ref class.
Enables boxing conversions from a value class T or enum class T to Box<T>.
operator Box<T>^(T valueType); T
Any enum type, value class, or value struct. Includes the built-in types in the default namespace.
A Platform::Box<T>^ instance that represents the original value boxed in a ref class.
Returns the value that is encapsulated in the Box object.
virtual property T Value{
T get();
} Returns the boxed value with the same type as it originally had before it was boxed.