C
Charles Law
Sorry for asking this one again, but with the newsgroup now holding things
for an ever shorter time, I can't find my original question (and the
answers) from a few months ago.
I know that structures in VB.NET don't have bit fields, but I am looking for
a convenient way to reproduce the convenience afforded in C/C++.
If I have
typedef struct _MyStruct {
DWORD First
DWORD Second : 1
DWORD Third : 1
DWORD Fourth : 2
...
} MyStruct;
I would be forced to translate this into
Public Structure MyStruct
Dim First As Integer
Dim Flags As Integer
...
End Structure
and decode the values of Flags.
Does anyone have any suggestions for an elegant way to deal with this
scenario, ideally getting the benefit of intellisense, so that I can say
Flags = ValueOfThird
resulting in just bit 1 of the Flags element becoming set? Perhaps using an
enum with the FlagsAttribute?
Thanks.
Charles
for an ever shorter time, I can't find my original question (and the
answers) from a few months ago.
I know that structures in VB.NET don't have bit fields, but I am looking for
a convenient way to reproduce the convenience afforded in C/C++.
If I have
typedef struct _MyStruct {
DWORD First
DWORD Second : 1
DWORD Third : 1
DWORD Fourth : 2
...
} MyStruct;
I would be forced to translate this into
Public Structure MyStruct
Dim First As Integer
Dim Flags As Integer
...
End Structure
and decode the values of Flags.
Does anyone have any suggestions for an elegant way to deal with this
scenario, ideally getting the benefit of intellisense, so that I can say
Flags = ValueOfThird
resulting in just bit 1 of the Flags element becoming set? Perhaps using an
enum with the FlagsAttribute?
Thanks.
Charles