Create a function in C# which can accept varying number of arguments?
Loading
Create a function in C# which can accept varying number of arguments?
The section about single-line and multi-line comments was especially helpful because those are the ones people use most when starting with C#. sprunki
Hi Brahma Prakash Shukla,
“params“ can be used to create a function in C# which can accept varying number of arguments as like following:
void PrintReport(string header, params int[] numbers){Console.WriteLine(header);foreach (int number in numbers)Console.WriteLine(number);}
For more details:
Function with variable number of arguments
https://stackoverflow.com/questions/9784630/function-with-variable-number-of-arguments
Hope, this will help you!