Solved

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

Posted on 2008-06-22
2
334 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
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.net/WinForms: adjust Screen Resolution 6 42
C# Offline Apllication 5 55
Angular - break the dataset in chunks? 7 39
Need a starter for ETL protocol? 4 43
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

867 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now