Skip to content

Latest commit

 

History

History
63 lines (58 loc) · 1.07 KB

how-to-unbox.md

File metadata and controls

63 lines (58 loc) · 1.07 KB
title How to: Unbox | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.reviewer
ms.suite
ms.technology
cpp-windows
ms.tgt_pltfrm
ms.topic article
dev_langs
C++
helpviewer_keywords
unboxing
ms.assetid 75794696-9275-47bf-9a7d-5abe6585ab91
caps.latest.revision 10
author mikeblome
ms.author mblome
manager ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

How to: Unbox

Shows how to unbox and modify a value.

Example

// vcmcppv2_unboxing.cpp  
// compile with: /clr  
using namespace System;  
  
int main() {  
   int ^ i = gcnew int(13);  
   int j;  
   Console::WriteLine(*i);   // unboxing  
   *i = 14;   // unboxing and assignment  
   Console::WriteLine(*i);  
   j = safe_cast<int>(i);   // unboxing and assignment  
   Console::WriteLine(j);  
}  
13  
14  
14  

See Also

Boxing