首页 > 代码库 > 关于lambda表达式树

关于lambda表达式树

总而言之:

就是在表达式中没有花括号。

IEnumerable<Rect> rectlist3 = rectlist.Select(rect =>newRect(rect.X + 2, rect.Y, rect.rect.Width, rect.rect.Height));   

因此=>接翻译成:

Func(Rect rect, out Rect a)

{

return rect =>newRect(rect.X + 2, rect.Y, rect.rect.Width, rect.rect.Height);

}

 

IEnumerable<Rect> rectlist4 = rectlist.Where(rect => rect.X>5);

Func(Rect rect, out bool a)

{

return rect => rect.X>5;

}

 

IEnumerable<Rect> rectlist6=rectlist4.OrderBy(rect=>rect.Y);

 

Func(Rect rect, out int a)

 

{

 

return rect=>rect.Y

 

}

 

关于lambda表达式树