explicit unboxing of an object to an int

   
  

using System;

class MainClass {

    public static void Main() {
        object myObject = 3;
        int myInt3 = (int)myObject;  // myObject is unboxed
        Console.WriteLine("myInt3 = " + myInt3);


    }

}

   
     


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