Is there any overhead in the use of anonymous methods?

后端 未结 8 1739
遇见更好的自我
遇见更好的自我 2021-02-15 17:27

I would like to know if there is any overhead incurred through the use of anonymous methods when creating a Background worker.

for example:

public void S         


        
8条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-15 17:51

    I was testing this out the other day (via use of the StopWatch class). As far as I could tell there was no noticeable difference in performance between invoking a method directly...

    SomeMethod();
    

    ...or via an anonymous method...

    () => SomeMethod();
    

提交回复
热议问题