What is the => token called?

我的未来我决定 提交于 2019-12-17 16:44:22

问题


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


回答1:


Lambda operator




回答2:


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.




回答3:


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




回答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




回答5:


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".



来源:https://stackoverflow.com/questions/879860/what-is-the-token-called

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!