3

What's the name of the "=>" operator (e.g in C# linq .Select(x=>x.Prop1) )

It might not even be an operator.

Does it have a different name in different languages (C# vs JavaScript)

Tagging as operator / C# / javascript - Not sure where this fits in...

Matt
  • 25,943
  • 66
  • 198
  • 303
  • 4
    It's a "lambda operator" https://msdn.microsoft.com/en-nz/library/bb311046.aspx In JS it's an "arrow function operator" – zerkms Sep 16 '16 at 21:20
  • 3
    And it's pronounced "goes into" e.g. "x goes into x dot prop1" – John Wu Sep 16 '16 at 21:20
  • 2
    @JohnWu: I don't think I've ever heard of it as "goes into" - but "goes to" instead. (Or just "to", e.g. "x to x dot prop1". – Jon Skeet Sep 16 '16 at 21:22
  • 1
    The things you learn on SO! [link](http://stackoverflow.com/questions/274022/how-do-i-pronounce-as-used-in-lambda-expressions-in-net) – John Wu Sep 16 '16 at 21:23

3 Answers3

6

In C# it's called a "lambda operator". In JS it's called an "arrow function operator".

References:

zerkms
  • 249,484
  • 69
  • 436
  • 539
1

The => shorthand declaration of a function in javascript.

Example usage would be:

addition:(x,y)=>{
   return x+y
}
1

It's sometimes called a "fat arrow" (or "big boned arrow") but most often called a "lambda"

Eonasdan
  • 7,563
  • 8
  • 55
  • 82
  • `=>` is called a "fat arrow" in PHP but not in C#. Nevertheless, I found that .NET people also understand that name since it's kind of a descriptive term. – wp78de Aug 29 '22 at 18:29