Feb 11

that is generated by the WebRequest class. Against all odds, the 1st parameter that a method that handles this event receives is not of type WebRequest as you might expect. I say might expect because the client event system is supposed to mimic the .NET event system, where the 1st parameter passed to a method that handles the event is always the object that fired the event.

As you”ve certainly discovered (specially if you”ve handled the event), the 1st parameter passed to the event is a reference to the executor that was responsible for executing the request.  Though i really don”t like it, this approach has advantages too. For instance, most of the times you want to get a reference to the executor that was responsible for the request and with this approach you have a direct reference to the executor (without needing to access the property of the WebRequest object you”re using o perform the call).

However, I still would have prefered to receive a WebRequest object (instead of the reference to the executor)  because the event that i”m handling is fired by the WebRequest class. Yes, it”s true that this event is *really* raised by the executor (_onReadyStateChange), but since the event is exposed by the WebRequest class, I really really really do think that we should get a reference to an instance of that class. Just my 2 cents.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>