description | title | ms.date | ms.topic | f1_keywords | ms.assetid | |
---|---|---|---|---|---|---|
Learn more about: Platform::Box Class |
Platform::Box Class |
12/30/2016 |
reference |
|
b3d7ea37-e98a-4fbc-80b0-ad35e50250c6 |
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> . |
Value property | Returns the value that is encapsulated in the Box object. |
Creates a Box
that can encapsulate a value of the specified type.
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.