Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is the syntax () => ?
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01634746
Message ID:
01634780
Views:
56
It's what's called Expression Syntax, which can be used as 'anonymous functions'. It's basically a function (or single line expression) that is executed without requiring an explicit function name. The compiler turns that code into a delegate object with a method that is executed. IOW, it's compiler surgar for making life easier. It's just a more terse way to express to implement small snippets of code. For larger blocks of code it's still recommended that you rather use a named callback function instead.

It's primarily used with LINQ queries to handle inline query expressions, or for Async task callback functions.

The brackets describe the inbound parameter list and the type of the return value determines the type of the method.


Thanks for the nice concise explanation.
Previous
Reply
Map
View

Click here to load this message in the networking platform