maf*_*afu 3 .net c# using code-readability
鉴于这样的情况:
using (var foo = CreateFoo()) {
if (foo != null) {
// do stuff
}
}
Run Code Online (Sandbox Code Playgroud)
我想避免嵌套if.遗憾的是,显而易见的解决方案是不可能的,因为break不能用于:
using (var foo = CreateFoo()) {
if (foo == null) {
break;
}
// do stuff
}
Run Code Online (Sandbox Code Playgroud)
是否有一种模式仍然可以避免由此引起的额外缩进if != null?
| 归档时间: |
|
| 查看次数: |
1164 次 |
| 最近记录: |