- Beginning C# 7 Hands-On:Advanced Language Features
- Tom Owsiak
- 169字
- 2021-07-02 15:29:25
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[] { ',' });
- Dynamics 365 for Finance and Operations Development Cookbook(Fourth Edition)
- 簡單高效LATEX
- 看透JavaScript:原理、方法與實踐
- Silverlight魔幻銀燈
- Cassandra Data Modeling and Analysis
- Unity UI Cookbook
- Building Wireless Sensor Networks Using Arduino
- C++ Fundamentals
- Python趣味編程與精彩實例
- App Inventor 2 Essentials
- PHP+MySQL動態(tài)網(wǎng)站開發(fā)從入門到精通(視頻教學版)
- Java EE 8 and Angular
- PostgreSQL 12 High Availability Cookbook
- Selenium Essentials
- 軟件測試項目實戰(zhàn)之功能測試篇