C# Params

tutorial and example
tutorial and example

There are cases when we don’t know the actual number of parameters in the function call. Well, in C# we can pass any number of parameters in the function call by using params prior to the formal parameters in function definition. It is a keyword which is used to specify a parameter which can take unknown number of arguments. Only params is allowed and no extra arguments can be passed.

C# Params Example:

Output

C# Params Example 2: passing unknown number of objects to the function

Output :