rspec/rules/S4018/rule.adoc
2020-06-30 17:16:12 +02:00

38 lines
528 B
Plaintext

The best way to determine the type of a generic method is by inference based on the type of argument that is passed to the method. This is not possible when a parameter type is missing from the argument list.
== Noncompliant Code Example
----
using System;
namespace MyLibrary
{
public class Foo
{
public void MyMethod<T>() // Noncompliant
{
}
}
}
----
== Compliant Solution
----
using System;
namespace MyLibrary
{
public class Foo
{
public void MyMethod<T>(T param)
{
}
}
}
----