Curious C# using statement expansion

前端 未结 5 935
一个人的身影
一个人的身影 2021-01-17 07:31

I\'ve run ildasm to find that this:

    using(Simple simp = new Simple())
    {
        Console.WriteLine(\"here\");
    }

generates IL cod

5条回答
  •  天涯浪人
    2021-01-17 08:15

    using(Simple simp = null) is yet another reason that the expansion must check for null first.

提交回复
热议问题