unbox the reference back into a short : Byte box unbox : Data Type C# Examples


C# Examples » Data Type » Byte box unbox »

 

unbox the reference back into a short









    
using  System;
using  System.Collections;

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

    }
}
    
   
  
   



Output

short anotherShort = 25
Unboxed object is a: System.Int16


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Byte box unbox