Marking Assemblies and Types as CLS Compliant

Chapter 2, “The Visual Studio 2015 IDE for Visual Basic,” and Chapter 3, “The Anatomy of a Visual Basic Project,” offer an overview of assemblies. When you produce a reusable component such as a class library or a user control such as a .dll assembly, you need to ensure that it is CLS-compliant. You can add the following attribute to the assembly definition:

<Assembly: CLSCompliant(True)>

This attribute tells the compiler to check whether a type used in your code is CLS-compliant. If the compiler finds a non–CLS-compliant type, it reports a warning message. Assembly members should also be marked as CLS-compliant if you plan that they will be. A class is defined CLS-compliant ...

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.