what is the sense of having a flags enum like PropagationFlags if the content of the enum is:
- None: Specifies that no inheritance flag开发者_如何转开发s are set.
- NoPropagateInherit: Specifies that the ACE is not propagated to child objects.
- InheritOnly: Specifies that the ACE is propagated only to child objects. This includes both container and leaf child objects.
What will be the meaning of a variable with None | InheritOnly or NoPropagateInherit | InheritOnly?
I'm missing something or is this a .Net framework bad design?
The None
in that enum just means that you're not setting any flags, essentially that you want the default behavior. The framework guidelines state that the zero (and therefor non-set or essentially null) should be called None. In this case the name might be confusing because you may think it means 'No propagation' but it doesn't. The other two values are intended to be OR
'd together potentially. OR
'ing with zero always returns the original value.
I have drawn this small diagram which helps to quickly understand the effect of both PropagationFlags and InheritanceFlags.
Here is also a good MSDN link which explains some combination use cases: ACL Propagation Rules
精彩评论