Simple C# Noop Statement

后端 未结 15 731
面向向阳花
面向向阳花 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:40

    How about:

    GC.KeepAlive(e);
    

    where e is the exception variable?

    (I haven't tried putting a break point on the catch declaration itself. It feels like you ought to be able to do that, precisely for this reason. But whether it works or not is a different matter.)

    Or somewhat more cryptically, assuming you've already got a using directive for System.LINQ:

    "".AsEnumerable();
    

提交回复
热议问题