I found this post extremely useful – definitely worth a read.
I was working on a project recently that required me to have an Enum that allowed bit fields as opposed to the normal fields that we might deal with in our day to day endeavors with PowerShell.
If you aren’t quite sure what I mean by this, here is a quick example that shows the difference between the two.
First, the regular Enum that we are used to:
Notice that each number matches up to a single value: 0 = Sunday, 3 = Wednesday and so on.
Now for an Enum with bit fields:
You can see here that depending on the value, you may end up for more than 1 item. This typically will follow a 1,2,4,8,16…etc… approach for the single items and then they perform a bitwise XOR to combine values for more items.
Now that we have covered this topic in a very basic form, we still…
View original post 367 more words