88 lines
1.3 KiB
Plaintext
88 lines
1.3 KiB
Plaintext
== Why is this an issue?
|
|
|
|
The name of a parameter in an externally visible. This rule raises an issue when method override does not match the name of the parameter in the base declaration of the method, or the name of the parameter in the interface declaration of the method or the name of any other ``++partial++`` definition.
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,csharp]
|
|
----
|
|
partial class Point
|
|
{
|
|
partial void MoveVertically(int z);
|
|
}
|
|
|
|
partial class Point
|
|
{
|
|
int x = 0;
|
|
int y = 0;
|
|
int z = 0;
|
|
|
|
partial void MoveVertically(int y) // Noncompliant
|
|
{
|
|
this.y = y;
|
|
}
|
|
}
|
|
|
|
interface IFoo
|
|
{
|
|
void Bar(int i);
|
|
}
|
|
|
|
class Foo : IFoo
|
|
{
|
|
void Bar(int z) // Noncompliant, parameter name should be i
|
|
{
|
|
}
|
|
}
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,csharp]
|
|
----
|
|
partial class Point
|
|
{
|
|
partial void MoveVertically(int z);
|
|
}
|
|
|
|
partial class Point
|
|
{
|
|
int x = 0;
|
|
int y = 0;
|
|
int z = 0;
|
|
|
|
partial void MoveVertically(int z)
|
|
{
|
|
this.z = z;
|
|
}
|
|
}
|
|
|
|
interface IFoo
|
|
{
|
|
void Bar(int i);
|
|
}
|
|
|
|
class Foo : IFoo
|
|
{
|
|
void Bar(int i)
|
|
{
|
|
}
|
|
}
|
|
----
|
|
|
|
|
|
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[]
|