What are parameter array ? How is parameter array declared ?

A parameter array allows variable number of arguments to be passed to a method. A parameter array is declared with the params modifier. Only the last parameter of a method can be a parameter array, and the type of a parameter array must be a single-dimensional array type.

Example :

public static void DisplayEmployeeDetails(string name, params object[] args) {...}

No comments:

Popular Posts