CLS is more about rules of .Net and it's a subset of CTS(Common Type System). You must be thinking of CTS, don't worry will discuss in my next article.
So CLS, is a basic set of language rules needed by the applications. CLS ensures Interoperability on other .Net languages. So if i want my C# code can communicate with VB code then it should be CLS compliant. If i will voilate any of C# compliant rule my VB.Net code will not be able to communicate with my C# code.
Now you must be thinking how i can assure my code is CLS compliant. So you can write an attribute in your assembly - Assembly.cs file.
[assembly : CLSCompliant(true)]
So after that whenever you will be breaking any of the rule you will get a warning in your code and CLS Compliancy
If you are interested in reading the CLS rules then visit here
So now you understand about CLS now i will discuss some code to see live example -
So now if i try to access my non compliant code in other language, I will not be able to use that. So using those warnings i can see that whether my code is CLSCompliant or not.
Hope you enjoyed reading the article.Let me know if you have any queries.
So CLS, is a basic set of language rules needed by the applications. CLS ensures Interoperability on other .Net languages. So if i want my C# code can communicate with VB code then it should be CLS compliant. If i will voilate any of C# compliant rule my VB.Net code will not be able to communicate with my C# code.
Now you must be thinking how i can assure my code is CLS compliant. So you can write an attribute in your assembly - Assembly.cs file.
[assembly : CLSCompliant(true)]
So after that whenever you will be breaking any of the rule you will get a warning in your code and CLS Compliancy
If you are interested in reading the CLS rules then visit here
So now you understand about CLS now i will discuss some code to see live example -
So now if i try to access my non compliant code in other language, I will not be able to use that. So using those warnings i can see that whether my code is CLSCompliant or not.
Hope you enjoyed reading the article.Let me know if you have any queries.
0 comments:
Post a Comment