Making the delegate
Enter using System
as usual at the very top of the file. Next, to make a delegate, enter the following:
delegate double CompareValues(double x, double y);
In this line, you have a delegate
class. It returns a double
and accepts two double
data types. So, it encapsulates functions that have that kind of signature.
In the next stage, you'll enter the following within curly braces:
public partial class_Default: System.Web.UI.Page
This line inherits from Page
as usual.
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...