_errors=_errors|Errors.Name;_errors=_errors|Errors.Date;...// check present of a flagvarhasDateError=_errors.HasFlag(Errors.Date);
Alternative syntax to define them using C# 7 binary literals
[Flags]publicenumErrors:int{// to represent absence of any flagNone=0b0000_0000_0000_0000,Name=0b0000_0000_0000_0001,Date=0b0000_0000_0000_0010,Time=0b0000_0000_0000_0100,...}
Or shift syntax
[Flags]publicenumErrors:int{// to represent absence of any flagNone=0,Name=1<<0,// 1Date=1<<1,// 2Time=1<<2,// 4...}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Alternative syntax to set flags.
Alternative syntax to define them using C# 7 binary literals
Or shift syntax