Which of the following statements is false?
Consider the following Cube method:
```
static int Cube(int x)
{
return x * x * x;
}
```
a) In C# 6, this method can be defined with an expression-bodied method as
static int Cube(int x) => x * x * x;
The value of x * x * x is returned to Cube’s caller implicitly.
b) The symbol => follows the method’s parameter list and introduces the method’s
body—no braces or return statement are required. This can be used only with static
methods.
c) If the expression to the right of => does not have a value (e.g., a call to a method that
returns void), the expression-bodied method must return void.
d) Similarly, a read-only property can be implemented as an expression-bodied property. The
following re-implements the IsNoFaultState property we used in the textbook to return the
result of a logical expression:
public bool IsNoFaultState =>
State == "MA" || State == "NJ" || State == "NY" || State == "PA&";
b) The symbol => follows the method’s parameter list and introduces the method’s
body—no braces or return statement are required. This can be used only with static
methods.
You might also like to view...
If a user exceeds the maximum length of text allowed in a text box, the data typed after the limit is reached is not accepted by the browser
Indicate whether the statement is true or false
In a SOHO environment, placing a VoIP unit on the outside edge of a LAN router enhances which of the following network optimization methods?
A. Load balancing B. Quality of service C. Fault tolerance D. Traffic shaping