Gforse Gforse - 2 months ago 5
Vb.net Question

Converting C++ #Define enum creation to vb.net

For a project i need to a Enum list writen in C++ converterd to en VB.net Enum list. So far everything is OK except for the #define enums that are in the C++ list. Here's what i whant to convert:

typedef enum
{
#define EnumValue(a,b) a, b=a+255
EnumValue(PARAM_Start,PARAM_END)
} ID;


As you can see this creates 255 enums values at runtime. How is this done in VB.net?

EDIT / SOLVED 30-09-2016

As mentioned below i made the wrong assumption by thinking it would create 255 enums, instead it creates just two enums however given
PARAM_END
an extra offset of 255. Meaning: if i have a three enums, the index of these enums are 0,1,3. Now if i want the index of
ENUM_3
to begin at 10 i just add
ENUM_2 + 8
this way ENUM_3 will start at index 10.

Thanks all for responding so fast and helping me out! :-)

Answer

The VB equivalent is:

Public Enum ID
 PARAM_Start
 PARAM_END=PARAM_Start+255
End Enum

Not 255 values as you stated, but just 2.

Comments