S2436 — Types and methods should not have too many generic parameters

Language
C#
Type
Code smell
Severity
Major
Tags
brain-overload

Why is this an issue?

A method or class with too many type parameters has likely aggregated too many responsibilities and should be split.

Noncompliant code example

With the default parameter value of 2:


<S, T, U, V> void foo() {} // Noncompliant; not really readable
<String, Integer, Object, String>foo(); // especially on invocations

↑ Back to top