For which type of arrays, we can use the params keyword?

 Posted by Ddd on 2/7/2011 | Category: C# Interview questions | Views: 2592 | Points: 40
Answer:

To clearly understand the params keyword , consider these examples:

//Correct
1)Single dimensional
static void demod(params int[] k)
{

}

2) Jagged array;

Note that we can use a multidimensional array using a jagged array


//Correct
1) static void demo(params int[][,] k)
{

}
Single dimensional array also OK with a jagged array.
//Correct
2)static void demog(params int[][] k)
{

}
3)Multidimensional array cannot be used directly

//Wrong
static void demok(params int[,] k)
{

}


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response