What is the value of an anonymous unattached block in C#?

后端 未结 10 1520
谎友^
谎友^ 2021-01-11 20:43

In C# you can make a block inside of a method that is not attached to any other statement.

    public void TestMethod()
    {
        {
            string x          


        
10条回答
  •  离开以前
    2021-01-11 20:50

    As far as I can see, it'd only be useful from an organizational standpoint. I can't really conceive of any logical value in doing that. Perhaps someone will have a proper example.

提交回复
热议问题