“一篇有意思的文章”的一个回复

  1. Otherwise an enum like this:

    enum Test{ ValueA = 1, ValueB = 2, ValueC = 4, ValueAB = ValueA | ValueB // 3}

    Will result in the initial checks having the combined value being checked if only one of the values is actually set. And when it returns the value it erringly adds values instead of ORing them.

    So if you have ValueAB checked, the value returned will be 6 (ValueA + ValueB + ValueAB) where-as the correct value is 3 (ValueAB).

    If you don’t mind, I’ll be using this code in the next version of my Wizard framework[^]. The only changes I made aside from the two fixes above was to change the namespace to match what I use in the framework. I have also included comments that the original code is yours.

    James

    唉,我好笨

发表评论

邮箱地址不会被公开。 必填项已用*标注