官术网_书友最值得收藏!

Creating an expression-bodied lambda

Next, you'll define the body of the Lambda. Because this lambda will do several things, you can enclose the body of it within a set of curly braces as follows:

{
double x = xin, y = yin;
}

So, this line assigns the values from the parameters above.

Next enter the following directly below this line:

return x > y ? x : y;

So, if x is greater than y, then return x; otherwise, return y. This is an expression-bodied Lambda, and you close it at the end with a semicolon after the closed curly brace, like this };. As you can see, this Lambda expression spans multiple lines. So, you can again inline code just as with the preceding line, using the double FromStringToDouble(string s) => Convert.ToDouble(s); function.

主站蜘蛛池模板: 施秉县| 大竹县| 铜山县| 洛扎县| 米泉市| 穆棱市| 石狮市| 四会市| 永昌县| 秦皇岛市| 泌阳县| 玛多县| 庄浪县| 咸丰县| 柳江县| 长葛市| 泰宁县| 麻阳| 雅江县| 凤翔县| 平原县| 扎鲁特旗| 沙坪坝区| 桑日县| 谢通门县| 黔西县| 昌邑市| 屏东县| 砚山县| 林州市| 长宁区| 遂宁市| 涞水县| 石首市| 安多县| 高雄县| 多伦县| 晴隆县| 博客| 庆元县| 仲巴县|