What is the purpose of CLS in the .NET platform?

I am confused about the purpose of the CLS (Common Language Specification) in the .NET Framework.

I understand that with .NET we can write a library with one language and use it in another language, and the CLR will enable this function. I know that the goal of CLS is to fully interact with other objects regardless of the language in which they were implemented.

What is CLS; what is his purpose?

+4
source share
2 answers

CLS is a guideline intended for component developers as well as compiler-compilers. He points out what is allowed and what is not allowed to create components, and create language support so that they are portable and fully compatible for consumption / interaction with all CLS friendly languages โ€‹โ€‹that can run in the CLR .

While the CLR has specifications that are exposed and implemented by the implementation. CLS is just a guideline. You can still write components that break the CLS but work fine in the CLR . But in this case, they may not interact with certain languages.

Obviously, CLS very important for compiler and language designers. But even as a component developer, itโ€™s important to stay within the CLS strings if you strive for complete interchangeability.

+6
source

I think that with .Net we can write a library with one language and use it in another language, and for this there is a CLR, what exactly is CLS, what is its purpose?

Although this language integration is fantastic, the truth is that programming languages โ€‹โ€‹are very different, so to help you do this or make the CLR achieve this -

Microsoft has defined a common language specification ( CLS ), which the compiler providers must provide for the details of the minimum set of functions, the compiler must support if these compilers must generate types compatible with other components written by other CLS compatible languages โ€‹โ€‹on top of the CLR.

+1
source

All Articles