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
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for