Tips for Making Your Code CLS-Compatible
The CLS is generic in that it accounts for what any CLS-compliant language needs. Because most of the C# language specification follows CLS-compliance rules, many applications written in C# are CLS-compliant. However, there are still a few items to consider.
When the CLSCompliant attribute is applied to an assembly, the C# compiler checks code for CLS compliance and generates an error or warning on violations. The assembly-level CLSCompliant attribute is declared after using statements and before any code as follows:
[assembly: CLSCompliant(true)]
The CLSCompliant attribute may also be applied to any type or its members. The CLSCompliant attribute may decorate a type without a type specification as the ...
Get C# 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.