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

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.

主站蜘蛛池模板: 肇源县| 乳山市| 隆安县| 南雄市| 临沭县| 陵水| 延长县| 钦州市| 华安县| 榆林市| 盐边县| 建阳市| 和平区| 武平县| 宜良县| 芜湖市| 九台市| 桃源县| 霍城县| 互助| 荆州市| 始兴县| 上思县| 新和县| 克什克腾旗| 凉山| 梅河口市| 甘泉县| 博乐市| 灵山县| 清远市| 全椒县| 阿城市| 安阳县| 太和县| 岳普湖县| 南召县| 龙里县| 堆龙德庆县| 松潘县| 方城县|