Swapnasagar Panda

Swapnasagar Panda

  • NA
  • 19
  • 12.1k

How to convert a Byte Array to decimal value and vice versa in c# 4.0 framework

Aug 8 2012 3:38 AM
How to convert a Byte Array to decimal value and vice versa in c# 4.0 framework.
The following code working in 2.0 and 3.5 , but giving exception in 4.0:--

byte[] bytearray = new bytearray[16];
MemoryStream m2 = new MemoryStream(bytearray);
         BinaryReader reader = new BinaryReader(m2);
    decimal dec = reader.ReadDecimal();
        Console.WriteLine(dec.ToString());
           Console.ReadLine();
          m2.Close();
      reader.Close();

Answers (1)