Maddus Mattus said:
Santa's Envoy said:
You cant make a extention method on a delegate, because a delegate is not an event.
The event keyword turns the delegate into an event.
Seeing as you cant write extension methods for keywords, they have made the workaround you've seen in this thread.
Like Erik and his team says; This is by no means a replacement for events, it just makes it easyer to work with them.
Well, you'll have to tell me, then, exactly how the event keyword modifies the delegate-type instance. As far as I'm concerned, it only encapsulates and limits access to the underlying object. Either way, it has already been shown[*] that it does not matter
whether the variable has been declared with the event modifier; it will not work either way (* Code in the first post).
I did not understand your point about writing extension methods for keywords. The event keyword simply tells the compiler to wrap that instance of the delegate type (in some way I do not pretend I know) and limit access to it. The underlying type of the
object is of the type you declared the event with. Thus, it is that type I'm going to try and extend. If you do understand more about the subject, I'd love to hear it. Again, it does not appear to be the case that the event keyword is responsible for this,
And for the last point: Yes, it pretty much is. I'm sure Erik wouldn't say it - or maybe he meant that the .NET Framework won't be rewritten to use Observables, or problably a combination of both - but it is obvious that that's exactly the idea (and understandably
so). Though, as we all know, "replacing events" is a fairly simplistic view of Observable's concept.