Given static void Show(int a, int b), which call uses named arguments correctly in C#?
Correct answer C. Show(b: 2, a: 1)
Explanation
Named arguments use the parameter name followed by a colon, so Show(b: 2, a: 1) passes 1 to a and 2 to b even though the order differs from the declaration. Names make calls with many parameters, especially booleans, easier to read. The = form would be parsed as assignments to variables a and b, not as argument names.
Answer checked How we write and check questions
Discussion