|
-
March 24th, 2011, 12:52 PM
#4
Re: Lambda expressions
The => operator indicates to the compiler that this is a lambda expression.
The empty parentheses to the left of the operator indicates that this lambda expression takes no arguments, while everything to the right of the operator is the body of the expression.
The body of the expression could be a call to a named function or it could be a bracketed series of one or more statements, to wit: {x++; return x * x;}
incidentally, I think that the braces {} may be omitted if there is only a single statment in the body, for instance () => parser.ParseThis(HTML_string); (although for the life of me, I can't imagine why anyone would use a single-statement lambda expression - perhaps as an argument to a function or to subscribe to an event - like a delegate).
Last edited by ThermoSight; March 24th, 2011 at 07:32 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|