I've found a lot of pages about CLS compliance.
I've understood that CLS compliance:
Many peolple write that "if you write code, you should write it CLS compliant." But as far I can read, there is no reason to use CLS compliance in generic software.
Am I right, or did I miss something?
Being CLS compliant means that you can write code that can be consumed by any language that can be compiled and run on the CLR.
CLS compliance has to do with interoperability between the different . NET languages. The property is not CLS compliant, because it starts with an underscore and is public (note: protected properties in a public class can be accessed from outside the assembly).
If you write a library or framework it makes sense to ensure your library can be used from any CLR language.
CLS-compliance is particularly important if you're distributing libraries - specifically, writing CLS compliant guarantees that your libraries will be usable by all CLS-compliant languages.
For instance, Visual Basic is not case-sensitive, whereas C# is. One of the requirements of CLS compliance is that public (and protected) member names should not differ only by case, thus ensuring that your libraries can be used safely by Visual Basic code, or any other .NET language that doesn't differentiate based on case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With