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

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.

主站蜘蛛池模板: 英山县| 东乌| 水城县| 颍上县| 广汉市| 文登市| 峡江县| 黔西| 武平县| 嵊泗县| 新源县| 临高县| 延吉市| 洮南市| 花莲县| 宁安市| 察隅县| 安远县| 东辽县| 和田县| 温州市| 旺苍县| 淳化县| 灵石县| 惠东县| 澄城县| 通州区| 海盐县| 桂阳县| 道孚县| 通辽市| 安岳县| 山西省| 弋阳县| 炉霍县| 内江市| 千阳县| 石棉县| 大足县| 安康市| 嘉义市|