【问题标题】:what does this "=>" operator mean in C#? [duplicate]这个“=>”运算符在 C# 中是什么意思? [复制]
【发布时间】:2015-08-20 17:12:01
【问题描述】:

PlayGamesPlatform.Instance.localUser.Authenticate((bool success) =>

在上面的代码 sn-p 中,这个“=>”是什么意思? 我一直找不到任何参考资料

【问题讨论】:

标签: c#


【解决方案1】:

它并不总是很明显,但在这种情况下,它是制作 lamda 代码的一部分,而不是

PlayGamesPlatform.Instance.localUser.Authenticate(something);

某些东西被声明为

bool something()
{
.. code ..
}

你可以随时做一些事情

PlayGamesPlatform.Instance.localUser.Authenticate((bool success) => { .. code .. } );

【讨论】:

    猜你喜欢
    • 2013-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-16
    • 2015-12-09
    • 2012-07-06
    • 2016-03-07
    • 1970-01-01
    相关资源
    最近更新 更多