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

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.

主站蜘蛛池模板: 长武县| 凉山| 华池县| 广饶县| 寿光市| 克东县| 乌兰察布市| 苏尼特右旗| 新田县| 顺昌县| 铁力市| 合阳县| 九台市| 班玛县| 祁东县| 呼伦贝尔市| 镇宁| 竹溪县| 隆安县| 安平县| 屯昌县| 札达县| 板桥市| 赞皇县| 遂平县| 加查县| 临邑县| 儋州市| 锦屏县| 迁西县| 榆中县| 板桥市| 平塘县| 岐山县| 黄陵县| 东兰县| 萝北县| 昭苏县| 荥经县| 鄂托克前旗| 任丘市|