C# Get “Apply To” information from “Advanced Security Settings” for a directory

余生颓废 提交于 2019-12-06 15:55:48

All of this looks correct to me. The one thing I would try is, over the years, I've learned not to check flags with just

propagationFlags == PropagationFlags.None

Isntead, I tend to use

(propagationFlags & PropagationFlags.None) == PropagationFlags.None

This makes my code more resilient if new flags show up on the bit fields as new versions of APIs come around.

This principle applies even with the more complicated expressions, such as

(inheritanceFlags & (InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit)) == (InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit)

That's the one thing I would try right away.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!