I am trying to implement the following lines in python to C#
final_reg = hex(gain_st)+'400020'
After that, I need to write final_reg to a register which in python was written this way.
serial.write(int('A', 16), int(final_reg, 16))
But In C# I implemented my serial.write using a function called write_word_segment_addr(); For Ex, if I want to write 90 to A I write like this currently:
mem.write_word_segment_addr(0x7c032, 0x00000090); //A
How do I convert gain_st which is a UInt32 to hex and then add 400020 and then convert it to 0x format seen above so that I may write to my register?