What is the params keyword?

Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.

What is the params keyword?

Rating:

The params keyword provides the facility to specify a method parameter that takes a variable number of arguments. The number of arguments can vary. The following code snippet displays the use of the params keyword:

using System;
public class ParamTest
{
    public static void Main()
   {
       ParamFunc(1,2,3);
       ParamFunc(1,2,3,4,5);
       ParamFunc(1,2,3,4,5,6,7);
    }
    public void ParamFunc(params int[] arrlist)
   {
       foreach(int list in arrlist)
       Console.WriteLine(list);
    }
}


Rating:



Other articles

Click here to Article home

 
uCertify.com | Our Company | Articles | Privacy | Security | Contact Us | News and Press Release | uCertify India
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.