rspec/rules/S3262/csharp/rule.adoc
2022-02-04 16:28:24 +00:00

60 lines
910 B
Plaintext

Overriding methods automatically inherit the ``++params++`` behavior. To ease readability, this modifier should be explicitly used in the overriding method as well.
== Noncompliant Code Example
[source,csharp]
----
class Base
{
public virtual void Method(params int[] numbers)
{
...
}
}
class Derived : Base
{
public override void Method(int[] numbers) // Noncompliant, the params is missing.
{
...
}
}
----
== Compliant Solution
[source,csharp]
----
class Base
{
public virtual void Method(params int[] numbers)
{
...
}
}
class Derived : Base
{
public override void Method(params int[] numbers)
{
...
}
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]