Since_2008
Since_2008

Reputation: 2341

What does &H57 represent and how can I translate it for C#?

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

Answers (5)

SSS
SSS

Reputation: 5393

It's the letter W for crying out loud

Upvotes: -1

VMAtm
VMAtm

Reputation: 28355

It is hexadecimal representation of the 87. Use const byte request_efi = 0x57; or const byte request_efi = 87;

Upvotes: 1

Harry Steinhilber
Harry Steinhilber

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

Joshua
Joshua

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

Femaref
Femaref

Reputation: 61427

I guess it is a hexadecimal number. The syntax for that would be 0x57 in C#.

Upvotes: 5

Related Questions