Lamba表达式语法问题 [英] Lamba expression syntax issue

查看:104
本文介绍了Lamba表达式语法问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题很简单;来自 [ ^ ]有一个lambda表达式让我感到困惑:



Hi, my problem is simple; from the [^]there is a lambda expression that bugs me:

SendAction(() => All().CallOnEach<IListenTo<T>>(x => x.Handle(message)));





第一个封闭的paranthesis没有前缀。因为我不明白这个表达是什么意思。欢迎任何帮助。



The first closed paranthesis comes with no prefix. Because of that i don't understand what this expression is supposed to mean. Any help is welcome.

推荐答案

这只是意味着无效所以没有第一个lambda的输入变量(第二个定义一个x - 在此例如,它允许离开paranthesis。所以SendAction想要一个函数指针(也就是委托)作为参数 - 你只需要给它一个 - 与你的lambda内联。这有用吗?
this just means "void" so no "Input" variables for the first lambda (the second one defines one "x" - in this case it's allowed to leave the paranthesis away. So SendAction wants a function pointer (aka delegate) as Argument - you just give it one - inline with your lambda. Does this help?


这篇关于Lamba表达式语法问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆