10

The => token is part of the C# 3.0 lambda syntax. My efforts to find the name of this token have failed so far.

dss539
  • 6,804
  • 2
  • 34
  • 64
  • http://msdn.microsoft.com/en-us/library/bb311046.aspx Refers to it as the "lambda operator" which is often read as "goes to" – dss539 May 18 '09 at 21:16
  • Rubyists might call it the "broken space ship operator" :-) – Peter Kofler Jun 30 '09 at 11:46
  • Possible duplicate of [How do I pronounce "=>" as used in lambda expressions in .Net](https://stackoverflow.com/questions/274022/how-do-i-pronounce-as-used-in-lambda-expressions-in-net) – Michael Freidgeim May 12 '18 at 11:09

5 Answers5

14

Lambda operator

Gishu
  • 134,492
  • 47
  • 225
  • 308
John Rasch
  • 62,489
  • 19
  • 106
  • 139
7

What it is called, in terms of how to pronounce it when reading code, is covered by Eric Lippert in Reading Code Over the Telephone.

bdukes
  • 152,002
  • 23
  • 148
  • 175
6

It's referred to as the 'goes to' operator.

billb
  • 3,608
  • 1
  • 32
  • 36
4

Turns out the answer depends on the context:

c=>c+1

c goes to c plus one

(Customer c)=>c.Name

customer c becomes c dot name

(Customer c)=>c.Age > 21

customer c such that c dot age is greater than 21

Community
  • 1
  • 1
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
3

http://msdn.microsoft.com/en-us/library/bb397687.aspx

Taken from the above: All lambda expressions use the lambda operator =>, which is read as "goes to".

user109023
  • 31
  • 1