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} );
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for