In C #, could we imagine our own events without writing delegates?

I learned object oriented Java. Now in development in C #. This means that I never understood the functioning of delagates, but I know how to use them.

Recently, I found this page http://java.sun.com/docs/white/delegates.html .

If Java can create an event without delagates, is it possible to do the same in C #? Can we imagine our own events without writing one delegate?

(Question already asked in French here )

+5
source share
5 answers

, . , /, . , , Invoke typafe, , - , . , : Multicast<T>, Multicast<T1, T2> .. ( , .)

, , , .

- , -, , .

+8

, # . # :

An event - , . event , , event, .

, .

Microsoft answer Sun White Paper .

+7

, . .NET, . "Java-" , . , " " .

+1

, . . ( , )

0

? , , , , : , , , .

But if you provide some code to run when an event occurs, then there is no reason not to use delegates.

Delegates are subtle abstractions over method / function pointers, and therefore they add very little overhead. And IMO, no need to add overhead just for the sake of it.

0
source

All Articles