Write the DisplayStrings() method called in the code below using a parameter array declared in the method header. The method should write its arguments in a single line, followed by a newline. What will the output be after running Main()?using static System.Console;class ParamsDemo{static void Main(){string[] names = {"Mark", "Paulette", "Carol"};DisplayStrings("Ginger");DisplayStrings("George", "Maria", "Thomas");DisplayStrings(names);}}
What will be an ideal response?
The DisplayStrings() method should be similar to the following code:
private static void DisplayStrings(params string[] people)
{
foreach(string person in people)
Write("{0} ", person);
WriteLine("\n");
}
The output should be:
Ginger
George Maria Thomas
Mark Paulette Carol
Computer Science & Information Technology
You might also like to view...
When the result of a calculated field is too large to fit in a column, a series of pound signs # is displayed
Indicate whether the statement is true or false
Computer Science & Information Technology
A computer that is normally used by only one person at a time is called a
a. Server b. Mainframe c. Personal Computer d. Network
Computer Science & Information Technology