Ushort To Byte convert : Ushort : Data Type C# Examples


C# Examples » Data Type » Ushort »

 

Ushort To Byte convert









    
using  System;

class  MainClass
{
      static  void  Main()
      {
            ushort  sh  =  10;
            byte  sb  =  (byte)sh;
            Console.WriteLine("sb:    {0}  =  0x{0:X}",  sb);

            sh  =  1365;
            sb  =  (byte)sh;
            Console.WriteLine("sb:    {0}  =  0x{0:X}",  sb);
      }
}
    
   
  
   



Output

sb:  10 = 0xA
sb:  85 = 0x55


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Ushort