B
B
BadCats2018-03-24 19:55:58
C++ / C#
BadCats, 2018-03-24 19:55:58

Manually reraising a system event in c#?

Ust event botClient.OnMessage += BotClient_OnMessage;- which is subscribed to the BotClient_OnMessage method. The event itself is called every time the user sends a message. Event type

public event EventHandler<MessageEventArgs> OnMessage;
-i.e. type EventHandler- how to manually trigger an event OnMessage- if I do not interact directly with the delegate, but create my own delegate of the same type and the event with it - it does not make sense - because I need these built-in system events but with the ability to call them on one's own?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2018-03-24
@BadCats

No, events of type event can only be called by the class where it is declared. If declared as a public delegate , then it can be called from other classes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question