Solved

How do I convert a Hexstring to Binary in c#?

Posted on 2008-06-22
2
338 Views
Last Modified: 2013-12-16
How do I convert a binary hex string representation to type binary.

basically I have
string hexString = "0x0001B"

What I want is
Binary b = (hexString)'To Binary';

Whats the easiest way to do it?

Cheers,
Josh
0
Comment
Question by:Joshscorp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Accepted Solution

by:
philipjonathan earned 50 total points
ID: 21843908
0
 
LVL 12

Expert Comment

by:jandromeda
ID: 21844555
Try this code which gives you the binary value of the given hex value.
string binaryValue = Convert.ToString(Convert.ToInt32("0x0001B", 16), 2);

Open in new window

0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question