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

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[] { ',' });
主站蜘蛛池模板: 嵊州市| 南皮县| 临澧县| 始兴县| 扎鲁特旗| 佛冈县| 两当县| 黄骅市| 清水河县| 同仁县| 太仓市| 寿光市| 阿合奇县| 全椒县| 沈丘县| 永昌县| 双鸭山市| 临颍县| 蕉岭县| 大邑县| 从化市| 三台县| 武清区| 都匀市| 靖州| 陇川县| 湟源县| 淮滨县| 宣城市| 定西市| 项城市| 屯门区| 桑植县| 托克逊县| 兴义市| 虎林市| 马山县| 建德市| 曲靖市| 吉隆县| 穆棱市|