Defining CLS-Compliant Interfaces

The Common Language Specification also provides rules for interfaces. The first rule is that if you mark an interface as CLS-compliant, you cannot use CLS-incompliant types within signatures. The following interface is not correct because it is marked as CLSCompliant but uses a noncompliant type:

image

The second rule is that a CLS-compliant interface cannot define shared members. The last rule is that all members must be explicitly marked with the CLSCompliant attribute. The following is an example of CLS-compliant interface:

Naming Conventions

It is an implicit rule that identifiers for all CLS-compliant interfaces ...

Get Visual Basic® 2010 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.