Arrow function ( => )
Short single-expression functions.
Syntax
ReturnType Name(params) => expression;
Description
Functions whose body is a single expression are written in a single line using =>. Does the same thing as { return expression; } — more readable.
Example
Loading editor…
Expected output
17 Hello C#
When to use?
Short helper functions, LINQ expressions.