I found this piece of code in one. Please explain this syntax. Is this an event handler or something else? I've seen that Please help me understand this code. I understand the meaning of this code, but not the syntax. Any other example would be appreciated. Really it is the opponent to: The main difference is that it uses instead of declaring a different method as it has been said that the written MSDN Artistic Lambda syntax has the following forms: Then enter htmlWeb.PreRequest does not appear to be an event handler because the
+ tab tab is not generating the required code, and its symbol in Intelsians tells me that it is a normal member variable
+ = is usually used to add event handlers, I searched Google for words like "How to add handler to event #", but no such code was found.
HTML Web HTMLWeb = New HtmlWeb (); HtmlWeb.PreRequest + = Request = & gt; {Request.CookieContainer = New System.Net.CookieContainer (); Back true; }; Your code:
HtmlWeb htmlWeb = new HtmlWeb (); HtmlWeb.PreRequest + = Request = & gt; {Request.CookieContainer = New System.Net.CookieContainer (); Back true; };
bool PreRequest_EventHandler (HttpWebRequest request) {request.CookieContainer = New System.Net.CookieContainer (); Back true; } // ... HTML Web HTMLWeb = New HtmlWeb (); HtmlWeb.PreRequest + = PreRequest_EventHandler;
(input parameter) = & gt; Expression
request => in your code. Input parameter is left bracket because there is only one parameter. If there are two or more, then it is
(x, y) = & gt; ... .
No comments:
Post a Comment