Programming in C# — Question 137
You need to create a method that can be called by using a varying number of parameters.
What should you use?
Answer options
- A. enumeration
- B. Language-Integrated Query (LINQ) query expressions
- C. interface
- D. optional parameters
Correct answer: D
Explanation
The correct answer is D, as optional parameters allow you to define a method that can be invoked with a varying number of arguments. Options A, B, and C do not provide this flexibility; enumerations and interfaces serve different purposes in programming, while LINQ is specifically for querying data.