Aracılığıyla paylaş


Compiler Error CS0466

'method1' should not have a params parameter since 'method2' does not

You cannot use params parameter on a class member if the implemented interface doesn't use it.

Example

The following sample generates CS0466.

// CS0466.cs
interface I
{
   void F1(params int[] a);
   void F2(int[] a);
}

class C : I
{
   void I.F1(params int[] a) {}
   void I.F2(params int[] a) {}   // CS0466
   void I.F2(int[] a) {}   // OK

   public static void Main()
   {
      I i = (I) new C();

      i.F1(new int[] {1, 2} );
      i.F2(new int[] {1, 2} );
   }
}