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

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[] { ',' });
主站蜘蛛池模板: 儋州市| 嵩明县| 乡宁县| 晋宁县| 开封县| 普兰店市| 台东县| 安乡县| 乳山市| 陕西省| 乌拉特中旗| 衡水市| 凌云县| 积石山| 洪泽县| 伽师县| 尤溪县| 万山特区| 孙吴县| 连江县| 上林县| 铜梁县| 紫阳县| 鄂尔多斯市| 昭觉县| 商南县| 天柱县| 秀山| 苏州市| 湖北省| 乐至县| 尼玛县| 宾川县| 彩票| 常山县| 灵山县| 岢岚县| 达拉特旗| 潼南县| 临汾市| 巧家县|