惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Recent Announcements
Recent Announcements
L
Lohrmann on Cybersecurity
Vercel News
Vercel News
P
Palo Alto Networks Blog
P
Proofpoint News Feed
WordPress大学
WordPress大学
Know Your Adversary
Know Your Adversary
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
K
Kaspersky official blog
T
Threat Research - Cisco Blogs
GbyAI
GbyAI
L
LangChain Blog
Y
Y Combinator Blog
T
Tenable Blog
腾讯CDC
T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
NISL@THU
NISL@THU
A
Arctic Wolf
Security Latest
Security Latest
IT之家
IT之家
Latest news
Latest news
Cisco Talos Blog
Cisco Talos Blog
P
Privacy & Cybersecurity Law Blog
T
Tor Project blog
T
Threatpost
Simon Willison's Weblog
Simon Willison's Weblog
Last Week in AI
Last Week in AI
D
Darknet – Hacking Tools, Hacker News & Cyber Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
AWS News Blog
AWS News Blog
月光博客
月光博客
aimingoo的专栏
aimingoo的专栏
量子位
T
Troy Hunt's Blog
Blog — PlanetScale
Blog — PlanetScale
V
Vulnerabilities – Threatpost
I
InfoQ
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
Cyber Attacks, Cyber Crime and Cyber Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
I
Intezer
爱范儿
爱范儿
C
Cisco Blogs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org

博客园 - 俩醒叁醉

ASP.NET MVC 4 WebAPI. Support Areas in HttpControllerSelector SQL2000安装问题(转) sql server 2008安装需要一直重启。但重启后又没有达到效果。 为数据库中所有的用户数据表生成分页存储过程 SQL 2005 字段备注获取 __doPostBack方法解析 如何在三个月掌握三年的经验(转载&&笔记) jQuery Ajax的使用 JQuery资源网站 Cookie跨域、虚拟目录 深入分析跨域cookie的问题 CnBlogsDotText使用实例 轻松搭建博客平台-开源ASP.NET 博客Subtext 的安装 表达式目录树(源MSDN) Web 2.0 编程思想:16条法则 Control Adapter 以下代码提供查询数据库中是否存在某个值 URL Routing MVC Controllers和Forms验证
CSharp——Lambda 表达式
俩醒叁醉 · 2009-03-15 · via 博客园 - 俩醒叁醉
1、定义:

           a、Lambda 表达式是一个匿名表达式。

           b、可以包含表达式和语句

           c、可用于创建委托或表达式目录树类型

           d、语法:Input params => Expression or Code Block. (左边是数据参数,右边是表达式或语句块。)

                          Eg:

           //多个参数            (x, y) => x == y            //No params            (int x, string s) => s.Length > x            //无参数,注:只有一个参数时才能省略掉括号:x => x*x             () => SomeMethod()             //语句块。 注:语句块中使用了大括号。             (input parameters) => {statement;}
     注:Lambda 语句同匿名方法一样无法用于创建表达式目录树。
2、简单用途

       a、委托中使用(Lambda表达式)

       delegate int del(int i);
       del myDelegate = x => x * x;
       int j = myDelegate(5); //j = 25

       b、委托未使用(Lambda表达式)

       delegate int del(int i);
       del myDelegate = delegate(int i) {i*i };  //匿名方法
       int j = myDelegate(5); //j = 25
    c、创建表达式目录树类型:
         using System.Linq.Expressions;
         // ...
         Expression<del> = x => x * x;