9

Possible Duplicate:
What is the => token called?

Hey,

In LINQ what is the name of the => operator e.g:

list.Where(a => a.value == 5);
Community
  • 1
  • 1
Luke Belbina
  • 5,708
  • 12
  • 52
  • 75
  • Operators as such are hard to search for, but the combination ' operators' pretty quickly leads to the desired information usually. – Dirk Vollmar Nov 04 '10 at 22:32
  • On a side note are you familiar with the **-->** operator: http://stackoverflow.com/questions/1642028/what-is-the-name-of-this-operator –  Nov 04 '10 at 22:36
  • 1
    @Shiftbit Snark hunting, are we? – Michael Todd Nov 04 '10 at 22:37

6 Answers6

19

It's called the lambda operator and is pronounced "goes to".

From here.

Michael Todd
  • 16,679
  • 4
  • 49
  • 69
  • 5
    +1 just for beating skeet by 5 seconds :) There should be badge for that – Dennis Burton Nov 04 '10 at 22:32
  • @Dennis Trust me. I was shocked when I hit Save and Jon's answer appeared. However, I think he beat me by 4 seconds. (_I_ had to go look it up. Jon _knew_ it.) – Michael Todd Nov 04 '10 at 22:32
  • 2
    @Dennis: Um, I think I beat Michael. At least, my answer has the lower post ID :) – Jon Skeet Nov 04 '10 at 22:33
  • "Goes to"? That's silly, goes to what? The variable isn't going anywhere. If for some reason I was averse to just saying "a in lambda" I would probably use "for...in expression..." as in "for a in the expression a dot value equals 5". I guess "goes to" is shorter though. :P – CodexArcanum Nov 04 '10 at 22:39
  • @CodexArcanum: "Goes to" is a pretty frequently used way of pronouncing it. I tend to depend on the context though. "Goes to" is fine for a projection, but doesn't work as well in a predicate. – Jon Skeet Nov 04 '10 at 22:48
8

It's the lambda operator. Or at least, an expression of the form

x => y

(or any of the longer forms involving =>) is a lambda expression. (I don't personally tend to think of it as an operator as such, even though the linked page refers to the lambda operator. The C# 4 spec doesn't contain the phrase "lambda operator" anywhere.)

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
2

The lambda operator.

NRaf
  • 7,407
  • 13
  • 52
  • 91
1

You read it as "such that". So your example reads as "list where a such that a dot value equals 5"

Joel Lucsy
  • 8,520
  • 1
  • 29
  • 35
0

its called ... lambda

Gabe
  • 49,577
  • 28
  • 142
  • 181
0

Its used to create delegates or expression tree types, and yes the new term for it is lambda expression

Raymund
  • 7,684
  • 5
  • 45
  • 78