Aracılığıyla paylaş


'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to a class that is generic or nested inside a generic type

A class is declared with ComClassAttribute, but it is either generic or contained in a generic class or structure.

To be eligible for COM interop, a .NET Framework class must satisfy the following requirements:

  • It must be Public, all its containers must be Public, and it must expose at least one Public member.

  • It must not be abstract, that is, it must not be declared with MustInherit.

  • It must not be generic or be declared within a generic container type.

Error ID: BC31527

To correct this error

  • Change the declaration of the class so that it is not generic, and make sure its containing element is not generic.

    -or-

  • If the class or its containing element must be generic, remove ComClassAttribute from the class declaration. You cannot expose it to COM.

See Also

Concepts

Generic Types in Visual Basic

Reference

ComClassAttribute

Other Resources

COM Interop