我在谷歌上搜索了 Range 参数的作用的解释,但什么也没找到,所以我相信你会解释使用It.IsInRange(TValue from, TValue to, Range rangeKind)?时设置 Range.Inclusive 或 Range.Exclusive 有什么区别。
文档中指定的范围(枚举)参数-
Exclusive : The range does not include the to and from values.
Inclusive : The range includes the to and from values.
Run Code Online (Sandbox Code Playgroud)
用法如答案所示
It.IsInRange(0, 100, Range.Exclusive); // will not match for int values 0 and 100, but matches 1 to 99
Run Code Online (Sandbox Code Playgroud)
和
It.IsInRange(0, 100, Range.Inclusive); // will match for int values 0 and 100, and in-between
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2501 次 |
| 最近记录: |