Maybe I'm just an idiot, but I had trouble finding this. I hope this saves people some time...

to specify hex in c#:

long MyHexVariable = 0x40;