CA1000: Do not declare static members on generic types

TypeName DoNotDeclareStaticMembersOnGenericTypes
CheckId CA1000
Category Microsoft.Design
Breaking Change Breaking


A generic type contains a static (Shared in Visual Basic) member.

By default, this rule only looks at externally visible types, but this is configurable.

Rule description

When a static member of a generic type is called, the type argument must be specified for the type. When a generic instance member that does not support inference is called, the type argument must be specified for the member. The syntax for specifying the type argument in these two cases is different and easily confused, as the following calls demonstrate:

' Shared method in a generic type.
GenericType(Of Integer).SharedMethod()

' Generic instance method that does not support inference.
someObject.GenericMethod(Of Integer)()
// Static method in a generic type.

// Generic instance method that does not support inference.

Generally, both of the prior declarations should be avoided so that the type argument does not have to be specified when the member is called. This results in a syntax for calling members in generics that is no different from the syntax for non-generics. For more information, see CA1004: Generic methods should provide type parameter.

How to fix violations

To fix a violation of this rule, remove the static member or change it to an instance member.

When to suppress warnings

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.


If you're running this rule from FxCop analyzers (and not with legacy analysis), you can configure which parts of your codebase to run this rule on, based on their accessibility. For example, to specify that the rule should run only against the non-public API surface, add the following key-value pair to an .editorconfig file in your project:

dotnet_code_quality.ca1000.api_surface = private, internal

You can configure this option for just this rule, for all rules, or for all rules in this category (Design). For more information, see Configure FxCop analyzers.

See also