Is there anything better than System.Byte.Parse ("0xAA") to get one byte in F # and C #?

So the question is in the title

I am doing System.Byte.Parse ("0xAA"), but I feel that every time the compiler parses the string and I just want to send this byte to the compiler.

I know there are F # literals (like 86uy), but I want exactly hex mode. Maybe I can write AAuy, but I canโ€™t understand how I can write it at the same time. Because, for example, 11uy and 11uy (in hexadecimal mode) are different // correct me if I am wrong.

Thanks.

+4
source share
2 answers

If you want to write the byte constant in hexadecimal, just 0xAAuy .

See F # Literals from MSDN.

+12
source

Do you mean something like this?

 // Valid C# byte x = 0xAA; 

(For the F # part, see Hanning's answer.)

+3
source

Source: https://habr.com/ru/post/1369631/


All Articles