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

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[] { ',' });
主站蜘蛛池模板: 疏附县| 贵南县| 昂仁县| 镇江市| 延安市| 恭城| 抚远县| 都匀市| 海原县| 桃园市| 九龙城区| 清涧县| 平度市| 石楼县| 长宁县| 吉安县| 城步| 西林县| 北票市| 永州市| 中西区| 崇义县| 嫩江县| 孟津县| 札达县| 杨浦区| 开化县| 崇礼县| 巧家县| 临西县| 淮滨县| 连山| 衢州市| 岢岚县| 建始县| 新宁县| 鹤岗市| 太白县| 吉木萨尔县| 小金县| 梨树县|