Is there a function equivalent to bin2hex()
of PHP for C #?
I need to convert a hexadecimal to binary. I tried to use TryParse
but it did not work.
Is there a function equivalent to bin2hex()
of PHP for C #?
I need to convert a hexadecimal to binary. I tried to use TryParse
but it did not work.
Yes, the type conversion functions allow you to use the base you need:
Convert.ToString(Convert.ToInt32("4F56A", 16), 2)
See running on dotNetFiddle and CodingGround .
Documentation Convert.ToString()
and Convert.ToInt32()
.