Partager via


Boxing (C++/CLI)

Boxing is the process of converting a value type to the type object or to any interface type that's implemented by the value type. When the common language runtime (CLR) boxes a value type, it wraps the value in a System.Object and stores it on the managed heap. L'unboxing extrait le type valeur de l'objet. La conversion boxing est implicite ; la conversion unboxing est explicite.

Articles connexes

Titre

Description

Comment : Explicitement conversion boxing de requête

Describes how to explicitly request boxing on a variable.

Comment : Gcnew d'utilisation pour créer des types valeur et utiliser la conversion boxing implicite

Shows how to use gcnew to create a boxed value type that can be placed on the managed, garbage-collected heap.

Comment : Unbox

Shows how to unbox and modify a value.

Conversions standard et boxing implicite

Shows that a standard conversion is chosen by the compiler over a conversion that requires boxing.

Programmation .NET dans Visual C++

The top-level article for .NET programming in the Visual C++ documentation.