explicit boxing of an int to an object

   
  
using System;

class MainClass {

    public static void Main() {
        int myInt2 = 10;
        object myObject = myInt2;  // myInt2 is boxed
        Console.WriteLine("myInt2 = " + myInt2);
        Console.WriteLine("myObject = " + myObject);


    }

}

   
     


This entry was posted in Data Types. Bookmark the permalink.