Skip to content

Latest commit

 

History

History
46 lines (41 loc) · 905 Bytes

how-to-unbox.md

File metadata and controls

46 lines (41 loc) · 905 Bytes
title ms.custom ms.date ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
How to: Unbox | Microsoft Docs
11/04/2016
cpp-windows
article
C++
unboxing
75794696-9275-47bf-9a7d-5abe6585ab91
10
mikeblome
mblome
ghogen

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