Simple C# Noop Statement

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

    If you really want noop, then this defines a nameless action that doesn't do anything, and then invokes it, causing nothing to happen:

    ((Action)(() => { }))();
    

提交回复
热议问题