However in most cases, such as the example you mention, it is better to use an enumeration. There are many examples in the .NET Framework itself where this convention is not followed, but that is because they introduced this design guideline fairly late on in the cycle.
”你在世界的法庭上
opinion right now, and you can answer
yes or no. You have denied that [the missiles]
存在,我想知道我是否
正确地理解了你... ... 我是
准备等待我的答复,直到
地狱结冰了,如果那是你的
决定”
如果您的方法中的标志具有这样的性质,您可以将其固定到 二进制决策,并且该决策将 永远不会转换为三方决策或 n 方决策,那么选择布尔值。指示: 您的标志称为 isXXX。
Don't make it boolean in case of something that is a mode switch. There is always one more mode than you thought of when writing the method in the first place.
The one-more-mode dilemma has e.g. haunted Unix, where the possible permission modes a file or directory can have today result in weird double meanings of modes depending on file type, ownership etc.
If your enums are 出版 in any way to external code and/or are saved outside of the program, consider numbering them explicitly. The compiler automatically numbers them from 0, but if you rearrange your enums without giving them values you can end up with defects.
In newer versions of C# it's possible to use named arguments which, IMO, can make calling code clearer in the same way that enums can. Using the same example as above: