Box the value type into a reference type : byte box unbox « Data Type « C# / CSharp Tutorial






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








2.15.byte box unbox
2.15.1.Boxing short
2.15.2.Box the value type into a reference type
2.15.3.unbox the reference back into a short