Mega Code Archive

 
Categories / C# Tutorial / Data Type
 

Box the value type into a reference type

using System; using System.Collections; class MainClass {   static void Main(string[] args)   {         short s = 25;          object objShort = s;     Console.WriteLine("Boxed object is a: {0}", objShort.GetType().ToString());   } } Boxed object is a: System.Int16