?
Solved

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

Posted on 2008-06-22
2
Medium Priority
?
340 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 150 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

AWS Certified Solutions Architect - Associate

This course has been developed to provide you with the requisite knowledge to not only pass the AWS CSA certification exam but also gain the hands-on experience required to become a qualified AWS Solutions architect working in a real-world environment.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

771 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