Home » C# Params

C# Params

In C#, params is a keyword which is used to specify a parameter that takes variable number of arguments. It is useful when we don’t know the number of arguments prior. Only one params keyword is allowed and no additional parameter is permitted after params keyword in a function declaration.

C# Params Example 1

Output:

2 4 6 8 10 12 14 

C# Params Example 2

In this example, we are using object type params that allow entering any number of inputs of any type.

Output:

Ramakrishnan Ayyer Ramesh 101 20.5 Peter A 

Next TopicC# Array class

You may also like