rspec/rules/S4019/csharp/rule.adoc

43 lines
737 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
When a method in a derived class has the same name as a method in the base class but with a signature that only differs by types that are weakly derived (e.g. ``++object++`` vs ``++string++``), the result is that the base method becomes hidden.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
using System;
namespace MyLibrary
{
class Foo
{
internal void SomeMethod(string s1, string s2) { }
}
class Bar : Foo
{
internal void SomeMethod(string s1, object o2) { } // Noncompliant
}
}
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
----
using System;
namespace MyLibrary
{
class Foo
{
internal void SomeMethod(string s1, string s2) { }
}
class Bar : Foo
{
internal void SomeOtherMethod(string s1, object o2) { }
}
}
----