Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Compiler Error CS0466 

Error Message

'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.


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} );
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.