Examveda

What is the correct syntax to define a method named CalculateArea that calculates the area of a rectangle with length and width parameters in C#?

A. double CalculateArea(double length, double width) { return length * width; }

B. CalculateArea(double length, double width) { return length * width; }

C. double CalculateArea(length, width) { return length * width; }

D. CalculateArea { double length * double width; }

Answer: Option B


Join The Discussion

Related Questions on Functions and Methods in C Sharp