A lambda expression is one of the following:
An expression whose evaluation yields a type which is the return type for that lambda function, e.g.
x => 2
(returns int, value 2)
(x,y) => x.GetType()
(returns System.Type)
(x) => x.ToString()
(returns string)
Or a statement block which is either void, or has no control paths which exit the function except through a return statement yielding a value of the return type of the function, e.g.
x => {
Console.Write("Hello World");
}
(of type void)
x => {
Console.WriteLine(x.ToString());
Console.WriteLine(Console.ReadLine());
}
(of type void)
x => {
if(x.ToString().Length == 0){
return "true";
}else
return "false";
}
(of type string)