The following screenshot shows how Default.aspx.cs looks now:
Figure 2.5.1: The current state of Default.aspx.cs
We'll now add some code so that it looks like this:
double x = 25.098114;//7. Value is needed so we have something to format
The value we set doesn't matter much, of course. We also added the preceding comment after the value.
Obviously, formatting is a big issue. You want the output that you generate on a web page, depending on your needs (for example, currency), to appear properly formatted.
Next, let's add the following comment:
//8. {x:C} prints the value of x formatted as currency
Now let's add the following statement below the comment:
sampLabel.Text = $"{x} formatted as currency is {x:C}";
Note that the $ symbol is there for string interpolation—it's not related to the...