CA1006: Do not nest generic types in member signatures
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at CA1006: Do not nest generic types in member signatures.
TypeName|DoNotNestGenericTypesInMemberSignatures|
|CheckId|CA1006|
|Category|Microsoft.Design|
|Breaking Change|Breaking|
An externally visible member has a signature that contains a nested type argument.
A nested type argument is a type argument that is also a generic type. To call a member whose signature contains a nested type argument, the user must instantiate one generic type and pass this type to the constructor of a second generic type. The required procedure and syntax are complex and should be avoided.
To fix a violation of this rule, change the design to remove the nested type argument.
Do not suppress a warning from this rule. 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.
The following example shows a method that violates the rule and the syntax that is required to call the violating method.
CA1005: Avoid excessive parameters on generic types
CA1010: Collections should implement generic interface
CA1000: Do not declare static members on generic types
CA1002: Do not expose generic lists
CA1004: Generic methods should provide type parameter
CA1003: Use generic event handler instances