Generics and Attributes (C# Programming Guide)
Attributes can be applied to generic types in the same way as non-generic types. For more information on applying attributes, see Attributes (C# Programming Guide).
Custom attributes are only permitted to reference open generic types, which are generic types for which no type arguments are supplied, and closed constructed generic types, which supply arguments for all type parameters.
The following examples use this custom attribute:
An attribute can reference an open generic type:
Specify multiple type parameters using the appropriate number of commas. In this example, GenericClass2 has two type parameters:
An attribute can reference a closed constructed generic type:
An attribute that references a generic type parameter will cause a compile-time error:
A generic type cannot inherit from Attribute: