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

Specifying the parameters

Now, in the next stage, enter the following underneath the closed curly brace after the preceding line:

static double CompareValuesInList(CompareValues compFirstTwo, double first, double second, double third)

After CompareValuesInList, you'll specify the parameters. So, the first one will be CompareValues. This indicates that a delegate can also be used as a type for a parameter. We'll give it the name compFirstTwo. Then, you do the double first, double second, and double third parameter. So, there are the three values to be passed in.

Next, enter the following within a set of curly braces beneath the preceding line:

return third > compFirstTwo(first, second) ? third : compFirstTwo(first, second);

What this line is saying is that, if third is greater than the result of comparing the first two compFirstTwo(first, second) parameter—(remember, this expression will run first, and then will return a value comparing the first two—), then it returns the third; otherwise, it will run compFirstTwo again and return the bigger of those two.

主站蜘蛛池模板: 丹巴县| 芜湖县| 额济纳旗| 台中市| 鹤壁市| 新疆| 日土县| 寻乌县| 昭苏县| 东安县| 江孜县| 汽车| 永嘉县| 蒙自县| 德钦县| 屯留县| 扎鲁特旗| 嵊州市| 衡阳县| 万山特区| 天柱县| 当雄县| 蓝田县| 喀什市| 师宗县| 社旗县| 股票| 大方县| 凉山| 曲水县| 鹰潭市| 体育| 桂平市| 沛县| 河津市| 蒙自县| 安图县| 华坪县| 鄂托克旗| 确山县| 波密县|