.NET events special methods (add/remove/raise/other)

后端 未结 2 1805
春和景丽
春和景丽 2021-01-02 01:23

I was wondering about the EventInfo.GetRaiseMethod and EventInfo.GetOtherMethods methods. Apparently, the CLR supports 4 kinds of methods associated with events: add, remove

2条回答
  •  感情败类
    2021-01-02 01:51

    Yes, C# can use the add/remove overloads for registering event handlers. EventInfo is the System.Reflection metadata that is used when parsing a class' signature; the RaiseEvent method in Visual Basic is not necessarily the same method as this one, as reflection creates a way for you to dynamically invoke an event or add an event handler. RaiseEvent is similar to calling the event in C# like a method.

    (This is a partial answer, as there are questions in your post I don't know the answer too.)

提交回复
热议问题