Vorgehensweise: Unboxing

Zeigt, wie Sie den Posteingang aufheben und einen Wert ändern.

Beispiel

// 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

Siehe auch

Boxing