- 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[] { ',' });
- 軟件安全技術
- Visual C++程序設計學習筆記
- Learning PostgreSQL
- Unity 2020 Mobile Game Development
- Python程序設計(第3版)
- 編譯系統(tǒng)透視:圖解編譯原理
- Java編程技術與項目實戰(zhàn)(第2版)
- C語言課程設計
- Getting Started with Laravel 4
- Angular開發(fā)入門與實戰(zhàn)
- 深入淺出React和Redux
- Java Web開發(fā)就該這樣學
- Python爬蟲、數(shù)據分析與可視化:工具詳解與案例實戰(zhàn)
- Java程序設計實用教程(第2版)
- Laravel Design Patterns and Best Practices