C# Methods with Unlimited Parameters

To create a method that can take unlimited parameters, utilize the params keyword in the method declaration.  This allows you to specify a method parameter that take an argument where the number of arguments is variable.   You are not allowed to have any other method parameters declared after a params method parameter.

MSDN resource: params

Example:

PSGMUMGGBJAR

About Carlos Ferreira

Comments

  1. Hi, I found this post from 2009 very useful: http://www.phoenixcode.net/post/2009/07/30/Method-Parameters.aspx

    • Hi Steven – Thanks for visiting and thanks for the link. Its very touching that you review posts from websites whose names include a mythical creature. Does that mean that *gasp* I’m mythical?

Leave a Reply

%d bloggers like this: