J
J
JustFill2022-02-04 16:36:03
C++ / C#
JustFill, 2022-02-04 16:36:03

Why is the return type of the method specified, a delegate named PriceChange?

I kind of understood this moment, but not really. I don't understand his behavior, what is he doing? It is of type in the property is specified in order to pass the value to the PriceChange delegate itself with the int price parameter? Can you please explain this point, otherwise, with these delegates, the whole head is already melting ...61fd2b5c0f937492314970.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
@
@insighter, 2022-02-04
_

A delegate is a wrapper that stores a pointer to one or more methods.
PriceChange describes methods with which parameters it can contain. PriceChangeHandler is a delegate type variable into which the pointer to the method will be placed. In order to call a method that is written in PriceChangeHandler, a call is made in this form PriceChangeHandler (parameters for the method)
Here it is crookedly done. I had to start an event.
Delegates are usually used to extend some kind of functionality.
But events (which are also delegates) are used more for notifications.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question