0

I have few controls in my view in which user will entre hex value.

Previously the user was entrying characters. Which i converted using

Alert = Convert.ToByte(collection["Alert"])

Now user wants to enter the value in hex.

I need to read from fromcollection to parse hex value that was entered by user. Then i need to convert that hex into its binary from.

I am new to programming kindly guide me.

Shanker Paudel
  • 740
  • 1
  • 9
  • 21

1 Answers1

0

Try this it is from this post

use syste.linq

string binarystring = String.Join(String.Empty,
  hexstring.Select(
    c => Convert.ToString(Convert.ToInt32(c.ToString(), 16), 2).PadLeft(4, '0')
  )
);
Community
  • 1
  • 1
Nilesh Gajare
  • 6,302
  • 3
  • 42
  • 73