当前位置:网站首页>C# Lambda
C# Lambda
2022-06-24 06:44:00 【Kenight_】
定义:Lambda 表达式是一个匿名函数,是简化匿名方法的一种方式
基本形式:x => x * x ,=> 是运算符,左边是参数,右边是表达式(或叫方法的实现代码)
示例:
void Start()
{
// Func 是预定义 delegate 泛型最后一个参数是返回值
Func<int, int, string> f = (x, y) =>
{
int i = x * y;
return i.ToString();
};
print(f(2, 5));
}参数
如果有多个参数需要使用 () ,一个时可以省略
表达式
如果只有一条语句,可省略 {} 和 return ,如 x => 2 * x
多行语句必须添加 {} 和 return
边栏推荐
- [image fusion] multi focus and multi spectral image fusion based on pixel saliency and wavelet transform with matlab code
- What is the mentality of spot gold worth learning from
- 2.1.1 QML grammar foundation I
- Global and Chinese market of anion sanitary napkins 2022-2028: Research Report on technology, participants, trends, market size and share
- JVM debugging tool -jmap
- 基因检测,如何帮助患者对抗疾病?
- 湖北专升本-湖师计科
- [Proteus] Arduino uno + ds1307+lcd1602 time display
- PCL point cloud random sampling by ratio
- Only two lines are displayed, and the excess part is displayed with Ellipsis
猜你喜欢

Camera calibration (calibration purpose and principle)
![[GUET-CTF2019]zips](/img/79/22ff5d4a3cdc3fa9e0957ccc9bad4b.png)
[GUET-CTF2019]zips

Canal installation configuration

现货黄金有哪些眩人的小技术?

bjdctf_2020_babystack

现货黄金有哪些值得借鉴的心态

Description of module data serial number positioning area code positioning refers to GBK code

学会使用楼宇控制系统BACnet网关没那么难

What is the mentality of spot gold worth learning from

Maxcompute remote connection, uploading and downloading data files
随机推荐
MySQL case: analysis of full-text indexing
[pointnet] matlab simulation of 3D point cloud target classification and recognition based on pointnet
10 common malware detection and analysis platforms
现货黄金有哪些眩人的小技术?
【Cnpm】使用教程
与(&&)逻辑或(||),动态绑定结合三目运算
How to turn on win11 notebook power saving mode? How to open win11 computer power saving mode
New ways to play web security [6] preventing repeated use of graphic verification codes
Global and Chinese market of basketball uniforms 2022-2028: Research Report on technology, participants, trends, market size and share
Serviceworker working mechanism and life cycle: resource caching and collaborative communication processing
[tips] use the deep learning toolbox of MATLAB deepnetworkdesigner to quickly design
2.1.1 QML grammar foundation I
What should I pay attention to after the live broadcast system source code is set up?
[OGeek2019]babyrop
Ultra wideband pulse positioning scheme, UWB precise positioning technology, wireless indoor positioning application
Deploy L2TP in VPN (Part 2)
Tencent cloud security and privacy computing has passed the evaluation of the ICT Institute and obtained national recognition
[image fusion] image fusion based on directional discrete cosine transform and principal component analysis with matlab code
When MFC uses the console, the project path cannot have spaces or Chinese, otherwise an error will be reported. Lnk1342 fails to save the backup copy of the binary file to be edited, etc
[Proteus] Arduino uno + ds1307+lcd1602 time display