Reputation: 2341
I'm trying to convert old VB.NET code into C# and I'm not sure about the current line and what it means really.
VB.NET:
Const REQUEST_EFI As Byte = &H57
What would this be in c#? I tried:
const byte request_efi = &H57;
But it says
"H57 is not part of the current context".
First of all, how is &H57 a byte? Second, it seems that the & operator has a different representation in this context aside from concatenation. Third obviously being, how the heck do I re-write this for C#? lol. Thanks!
Upvotes: 2
Views: 1218
Reputation: 28355
It is hexadecimal representation of the 87.
Use const byte request_efi = 0x57;
or const byte request_efi = 87;
Upvotes: 1
Reputation: 5239
&H## is how VB represents hexadecimal numbers. In this case it is the hex number 57 or 87 in decimal. the C# equivalent would be:
const byte request_efi = 0x57;
Upvotes: 2
Reputation: 8212
&H57
is a way to represent hex numbers in VB, so the C# equivalent would be:
const byte request_efi = 0x57;
Upvotes: 3
Reputation: 61427
I guess it is a hexadecimal number. The syntax for that would be 0x57
in C#.
Upvotes: 5