更新时间:2023-02-15 21:06:43
这一切看起来正确的给我。有一件事我会尝试的,这么多年来,我已经学会不检查标志只用
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,我倾向于使用
Isntead, I tend to use
(propagationFlags&安培; PropagationFlags.None)== PropagationFlags.None
这让我的code更有弹性,如果新的标志出现在该位字段的API的新版本过来。
This makes my code more resilient if new flags show up on the bit fields as new versions of APIs come around.
这个原则也适用更为复杂的EX pressions,如
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.