Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
The Common Language Specification (CLS) is a fundamental set of language features supported by the Common Language Runtime (CLR) of the .NET Framework. CLS is a part of the specifications of the .NET Framework. CLS was designed to support language constructs commonly used by developers and to produce verifiable code, which allows all CLS-compliant languages to ensure the type safety of code. CLS includes features common to many object-oriented programming languages. It forms a subset of the functionality of common type system (CTS) and has more rules than defined in CTS.
CLS defines the base rules necessary for any language targeting common language infrastructure to interoperate with other CLS-compliant languages. For example, a method with parameter of "unsigned int" type in an object written in C# is not CLS-compliant, just as some languages, like VB.NET, do not support that type.
CLS represents the guidelines to the compiler of a language, which targets the .NET Framework. CLS-compliant code is the code exposed and expressed in CLS form. Even though various .NET languages differ in their syntactic rules, their compilers generate the Common Intermediate Language instructions, which are executed by CLR. Hence, CLS allows flexibility in using non-compliant types in the internal implementation of components with CLS-compliant requirements. Thus, CLS acts as a tool for integrating different languages into one umbrella in a seamless manner.