Standard Conversions and Implicit Boxing
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Standard Conversions and Implicit Boxing

A standard conversion will be chosen by the compiler over a conversion that requires boxing.

// clr_implicit_boxing_Std_conversion.cpp
// compile with: /clr
int f3(int ^ i) {   // requires boxing
   return 1;

int f3(char c) {   // no boxing required, standard conversion
   return 2;

int main() {
   int i = 5;


© 2015 Microsoft