Enums - All options value

It should be like this:

[Flags] 
public enum SomeEnum
{
    SomeValue =  1,
    SomeValue2 = 1 << 1,
    SomeValue3 = 1 << 2,
    SomeValue4 = 1 << 3,
    All = SomeValue | SomeValue2 | SomeValue3 | SomeValue4
}

Since you should define the empty value in a Flags enum such as None = 0, the simplest way of defining the Allvalue is by simply inverting all the bits inNone`.

[Flags]
enum MyEnum
{
   None = 0,
   A = 1,
   B = 2,
   C = 4,
   ...
   All = ~None
}

Note that ~0 instead of ~None will not work for unsigned backing types as that is -1, which is not a valid value for unsigned.

Edit: Answer was modified to use an inverted None instead of an explicit constant such as 0x7FFFFFFF or ~0, as this also works for unsigned