Simple C# Noop Statement

后端 未结 15 685
面向向阳花
面向向阳花 2021-02-01 01:14

What is a simple Noop statement in C#, that doesn\'t require implementing a method? (Inline/Lambda methods are OK, though.)

My current use case: I want to occupy the c

15条回答
  •  有刺的猬
    2021-02-01 01:39

    Well the NOP in C# exists, as in C and is ';' and its correct definition is "the empty statement", but for the usage you intend, is enought to put the breakpoint in the closing catch bracket... There is no needing to Keep Alive anithing, since Tthe lifetime of an object reference in a method is extended to the end of the method when the debugger is attached. So you simply need to write

    catch(Exception exception)
    {
    }
    

    and put the breakpoint on the closing bracket and see the exception content.

提交回复
热议问题