Convert a decimal to a byte array and display : Decimal convert back and forth : Data Type C# Examples


C# Examples » Data Type » Decimal convert back and forth »

 

Convert a decimal to a byte array and display









    
using  System;
using  System.IO;
  
class  MainClass
{
        public  static  void  Main()  
        {
                using  (MemoryStream  stream  =  new  MemoryStream())  
                {
                        using  (BinaryWriter  writer  =  new  BinaryWriter(stream))  
                        {

                                writer.Write(2123859123.5638466123496m);

                                Console.WriteLine(BitConverter.ToString(stream.ToArray()));
                        }
                }

        }
}
    
   
  
   



Output

E8-16-6B-23-EF-99-A9-58-7F-04-00-00-00-00-0D-00


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Decimal convert back and forth