当前位置:网站首页>C# Lambda
C# Lambda
2022-06-24 08:04:00 【Kenight_】
Definition :Lambda The expression is an anonymous function , Is a way to simplify anonymous methods
Basic form :x => x * x ,=> It's the operator , On the left is the parameter , On the right is the expression ( Or method implementation code )
Example :
void Start()
{
// Func Is predefined delegate The last parameter of the generic is the return value
Func<int, int, string> f = (x, y) =>
{
int i = x * y;
return i.ToString();
};
print(f(2, 5));
}
Parameters
If there are multiple parameters to use () , One hour can be omitted
expression
If there's only one statement , Omission {} and return , Such as x => 2 * x
Multiline statements must be added {} and return
边栏推荐
- Vulnhub target: boredhackerblog: social network
- Atguigu---15- built in instruction
- 没有专业背景,还有机会成为机器学习工程师吗?
- ImportError: cannot import name ‘process_ pdf‘ from ‘pdfminer. Pdfinterp 'error completely resolved
- Inline element, block element, inline block element
- .jar中没有主清单属性
- 1-4metaploitable2 introduction
- Chapter 4 line operation of canvas
- 某问答社区App x-zse-96签名分析
- How to cancel the display of the return button at the uniapp uni app H5 end the autobackbutton does not take effect
猜你喜欢
解决笔记本键盘禁用失败问题
Hongmeng OS development III
Selenium IDE的安装以及使用
Cloud development who is the source code of undercover applet
ImportError: cannot import name ‘process_ pdf‘ from ‘pdfminer. Pdfinterp 'error completely resolved
The two most frequently asked locks in the interview
Svn actual measurement common operation record operation
exness:鲍威尔坚持抗通胀承诺,指出衰退是可能的
1-4metaploitable2 introduction
Leetcode 515 find the leetcode path of the maximum [bfs binary tree] heroding in each row
随机推荐
IndexError: Target 7 is out of bounds.
From jsonpath and XPath to spl
[special session] SME growth plan - ECS special session
What is the lifecycle of automated testing?
毕业两年月薪36k,说难也不难吧
JS implementation to check whether an array object contains values from another array object
On the H5 page, the Apple phone blocks the content when using fixed to locate the bottom of the tabbar
3-列表简介
How does dating software cut your leeks
First acquaintance with JUC - day01
力扣(LeetCode)174. 地下城游戏(2022.06.23)
Decltype usage introduction
Hongmeng development IV
Auto usage example
exness:鲍威尔坚持抗通胀承诺,指出衰退是可能的
Hongmeng OS development III
4-操作列表(循环结构)
The startup mode of cloudbase init is \Cloudbase init has hidden dangers
Oracle advanced SQL qualified query
LeetCode练习——跳跃游戏、组合求和