Consider FileAttributes
enumeration which is designed for bitwise operations. I've created a system in which, user selects some checkboxes to determine the status of a file. A file may be both ReadOnly
and System
. Thus the value would be 5 (1 for ReadOnly
and 4 four System
).
How can I validate an integer to be a valid FileAttributes
enumeration?
I've seen these questions, but they didn't help me, as they don't work for bitwised (flagged, combined) values.
Check that integer type belongs to enum member
Is there a way to check if int is legal enum in C#?