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

Defining an expression-bodied member

In the next stage, we will begin by defining an expression member, so enter the following between a set of curly braces:

double FromStringToDouble(string s) => Convert.ToDouble(s);

This line shows a new way of creating functions. That's what this is essentially. Instead of putting curly braces within the line, you can now just put something such as a Lambda expression, => in this case. Then the thing to be converted to a double data type will be the s string. It's also more streamlined; it looks a little more modern, like an expression-bodied member, like a function. Remember that functions are members of classes.

So, in the next stage, we'll define the Button click event below this line. If you go back to the Design view and double-click the button, it'll stick in the following line automatically:

protected void Button1_Click(object sender, EventArgs e)

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

string[] vals = TextBox1.Text.Split(new char[] { ',' });
主站蜘蛛池模板: 和顺县| 中超| 诸城市| 苍溪县| 莱西市| 潼南县| 木兰县| 广河县| 文登市| 金坛市| 九江县| 临夏市| 新巴尔虎右旗| 漳浦县| 宁波市| 永修县| 绥芬河市| 牟定县| 抚松县| 平阴县| 安平县| 铁力市| 宝应县| 宜黄县| 丰县| 伊金霍洛旗| 永新县| 利津县| 青岛市| 石柱| 澳门| 贺兰县| 曲靖市| 陵水| 佛坪县| 双流县| 建宁县| 灯塔市| 若尔盖县| 德庆县| 泗洪县|