what is common language specification in c#?Ask a question
The CLS is a guide-line intended for developers of components, as well as compiler-writers. It specifies what is allowed and what is not allowed in order to generate components, and build support for languages, in such a way that they are portable - and fully compatible to be consumed/interacted with from all CLS-compliant languages that can run in the CLR.
While the CLR has specifications that are exposed and enforced by the implementation. The CLS is just a guideline. You can still write components that break the CLS, but will work fine in the CLR. But in that case they might not be inter-operable with certain languages.
Obviously, the CLS is very important for compiler writers and language designers. But even as a component developer, it’s important to stay within the lines of the CLS if you’re striving for full inter-operability.