Examveda

What is the correct syntax to define a method named GetMax that takes two integer parameters num1 and num2 and returns the maximum of the two numbers in C#?

A. int GetMax = (int num1, int num2) => Math.Max(num1, num2);

B. int GetMax(int num1, int num2) { return Math.Max(num1, num2); }

C. GetMax { return Math.Max(num1, num2); }

D. None of the above

Answer: Option B


Join The Discussion

Related Questions on Functions and Methods in C Sharp