I’m using C# to write the following binary value to the system registry:
byte[] valueToSet = { 84, 01, 00, 00 };
Registry.SetValue(keyName, "00036601", valueToSet);
// returns void as expected.
When I view the written value using regedit, I see the displayed value as 54 01 00 00. This is incorrect
Conversely when I set the value to 84,01,00,00 manually in the registry, and run this code
object ttt = Registry.GetValue(keyName, "00036601", null);
// returns 132, 1, 0, 0
Is this an Endian issue? What is the correct way to fix this?
It’s a hexadecimal issue. RegEdit displays values in hexadecimal, and you’re working with decimal in C#.
The two values are equivalent: