Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0231

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() 

Community Additions

© 2014 Microsoft