Udostępnij za pośrednictwem


Type arguments unexpected because attributes cannot be generics

An attribute is applied using a type argument list.

Visual Basic and the .NET Framework do not currently support any combination of attributes and generic types. This means the following limitations apply:

  • An attribute cannot be a generic type or be declared within a generic type.

  • An attribute cannot inherit from a generic class, nor can a generic class inherit from an attribute.

  • When you apply an attribute, you cannot supply an argument that is any of the following:

    • A generic type,

    • A type constructed from a generic type,

    • A type parameter of a containing type, or

    • A type constructed from a type parameter of a containing type.

Error ID: BC32066

To correct this error

  • If the type arguments are intended to be normal arguments, then remove the Of keyword. Doing so turns the type argument list into a normal argument list.

  • If the type arguments are intended to be supplied to type parameters, then remove the Of keyword and all the type arguments. An attribute cannot accept type arguments.

See Also

Concepts

Attributes Overview in Visual Basic

Generic Types in Visual Basic

Reference

Attribute

Type List