0

In a C# application, int data type variable has been assigned with value 0x200. I didn't understand what kind of format it is. Also, if I try to write same statement in vb.net it gives me an error. Pls help

2

3 Answers 3

2

0x means the following value (in this case 200) is in HEX. 200 Hex is equal to 512 decimal

In C#

int i=0x200;

is equivalent to

int i=512;

In VB.net this can be written as

Dim x=512

OR

Dim x = &H200
Sign up to request clarification or add additional context in comments.

Comments

1

In C#

int x = 0x200;
Console.WriteLine(x);

In VB.NET

Dim x = &H200
Console.WriteLine(x)

It is just an assignement of a constant expressed with the Hexadecimal notation to a variable

Comments

0

For code conversion I recommend something like developerFusion Code Converter, it is great for putting a code snippet/example you find on the web in C# and having it convert to VB.NET. It will also convert from VB.NET to C#, as well as support for converting Python or Ruby (the .NET implementations of those being IronPython and IronRuby).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.