.net - Combining Enums -
is there way combine enums in vb.net?
i believe want flag type enum.
you need add flags attribute top of enum, , can combine enums 'or' keyword.
like this:
<flags()> _ enum combinationenums integer hasbutton = 1 titlebar = 2 readonly = 4 etc = 8 end enum
note: numbers right twice big (powers of 2) - needed able separate individual flags have been set.
combine desired flags using or keyword:
dim settings combinationenums settings = combinationenums.titlebar or combinationenums.readonly
this sets titlebar , readonly enum
to check what's been set:
if (settings , combinationenums.titlebar) = combinationenums.titlebar window.titlebar = true end if
Comments
Post a Comment