Logo 
Search:

C# FAQ

Submit Interview FAQ
Home » Interview FAQ » C#RSS Feeds

Does C# support a variable number of arguments?

  Shared By: Corinne Rogers    Date: Sep 02    Category: C#    Views: 2078

Answer:

Yes, using the params keyword. The arguments are specified as a list of arguments of a specific type, e.g. int. For ultimate flexibility, the type can be object. The standard example of a method which uses this approach is System.Console.WriteLine().

Share: 
 

Didn't find what you were looking for? Find more on Does C# support a variable number of arguments? Or get search suggestion and latest updates.


Your Comment
  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].


Tagged: