CA1005: Avoid excessive parameters on generic types

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

For the latest documentation on Visual Studio 2017, see CA1005: Avoid excessive parameters on generic types on docs.microsoft.com.

TypeNameAvoidExcessiveParametersOnGenericTypes
CheckIdCA1005
CategoryMicrosoft.Design
Breaking ChangeBreaking

An externally visible generic type has more than two type parameters.

The more type parameters a generic type contains, the more difficult it is to know and remember what each type parameter represents. It is usually obvious with one type parameter, as in List<T>, and in certain cases with two type parameters, as in Dictionary<TKey, TValue>. If more than two type parameters exist, the difficulty becomes too great for most users (for example, TooManyTypeParameters<T, K, V> in C# or TooManyTypeParameters(Of T, K, V) in Visual Basic).

To fix a violation of this rule, change the design to use no more than two type parameters.

Do not suppress a warning from this rule unless the design absolutely requires more than two type parameters. Providing generics in a syntax that is easy to understand and use reduces the time that is required to learn and increases the adoption rate of new libraries.

CA1010: Collections should implement generic interface

CA1000: Do not declare static members on generic types

CA1002: Do not expose generic lists

CA1006: Do not nest generic types in member signatures

CA1004: Generic methods should provide type parameter

CA1003: Use generic event handler instances

CA1007: Use generics where appropriate

Generics

Show: