Composing multicast delegates in C# - should I use operators or Action.Combine?

后端 未结 1 460
攒了一身酷
攒了一身酷 2021-01-18 04:02

Reading the documentation I can see that + operator can be used to compose/combine delegates of the same type.

In the same way I can see that I can remo

相关标签:
1条回答
  • 2021-01-18 04:30

    The delegate operators (+ and -) are shorthand for the static methods.
    There is no difference at all.

    a += b compiles to a = (Action)Delegate.Combine(a, b)

    0 讨论(0)
提交回复
热议问题