This documentation is archived and is not being maintained.

Compiler Error CS0231

Visual Studio 2008

A params parameter must be the last parameter in a formal parameter list.

The params parameter supports a variable numbers of arguments and must be after all other parameters. For more information, see Methods (C# Programming Guide).

The following sample generates CS0231:

// CS0231.cs
class Test
   public void TestMethod(params int[] p, int i) {} // CS0231
   // To resolve the error, use the following line instead:
   // public void TestMethod(int i, params int[] p) {} 

   static void Main()