Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0674 

Error Message

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

The C# compiler does not allow 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);
   }
}

Community Additions

ADD
Show:
© 2014 Microsoft