Floating curly braces in C#

前端 未结 6 1039
执念已碎
执念已碎 2020-12-03 11:42

I ran across a piece of C# code today I had not seen before. The programmer defined a block of code using only curly braces (no if, class, function, etc).

{
         


        
6条回答
  •  攒了一身酷
    2020-12-03 12:19

    The purpose of this is to illustrate that the int i is actually in a different scope than the incremented i below it.

提交回复
热议问题