rspec/rules/S3262/csharp/rule.adoc

50 lines
761 B
Plaintext
Raw Normal View History

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