- It is a set of rules, that define a subset of common types and programming constructs that all .NET programming languages can agree on.
- If no CLSCompliantAttribute is applied to a program element, then by default:
The assembly is not CLS-compliant.
The type is CLS-compliant only if its enclosing type or assembly is CLS-compliant.
The member of a type is CLS-compliant only if the type is CLS-compliant
Examples:-
- Jagged arrays — that is, arrays of arrays — are CLS-compliant. In the .NET Framework version 1.0, the C# compiler mistakenly reports that they are not.
- Enumerations must be of type Int16, Int32, or Int64. Enumerations of other types are not compliant.
- Example of non-CLS compliance:- For instance, unsigned types are supported by C# and MC++ but not by VB.NET (except for 'Byte', which is mapped on .NET's 'Byte' and takes values from 0 t o255). So, any public or protected member of a C# class that has an unsigned type or takes as parameter an unsigned is not CLS compliant.
No comments:
Post a Comment