Share via


Compiler Error CS0674

Do not use 'System.ParamArrayAttribute'. Use the 'params' keyword instead.

The C# compiler does not allow for the use of System.ParamArrayAttribute; use params instead.

The following sample generates CS0674:

// CS0674.cs
using System;
public class MyClass 
{

   public static void UseParams([ParamArray] int[] list)   // CS0674
   // try the following line instead
   // public static void UseParams(params int[] list) 
   {
      for ( int i = 0 ; i < list.Length ; i++ )
         Console.WriteLine(list[i]);
      Console.WriteLine();
   }

   public static void Main() 
   {
      UseParams(1, 2, 3);
   }
}