Standard Conversions and Implicit Boxing


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at 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;