Given the following variable:
float myFloat = 0xC0451EB8;
How do I get C0451EB8 from myFloat?
Edit: Not sure why I am being down voted here with no comment. I am not asking a simple hex representation of a float or uint32. I can do this. Given the variable definition above and a [possible common] answer of:
string FloatAsHex(float myFloat) {
return BitConverter.ToString(BitConverter.GetBytes(myFloat));
}
FloatToHex(0xC0451EB8); //will output 1F-45-40-4F, not what I expect
FloatToHex(BitConverter.ToSingle(BitConverter.GetBytes(0xC0451EB8))) //works
Although the second one obviously works, I only have access to the float variable.