Which rule applies to optional parameters in C#?
Correct answer D. They must come after all required parameters and have compile-time constant defaults
Explanation
Optional parameters are declared with a default value, such as int count = 10, and must follow every required parameter. The default must be a compile-time constant, a default(T) expression or new S() for a value type, because the value is copied into the calling code. Callers can skip them or name them, as in Print(text, count: 3).
Answer checked How we write and check questions
Discussion