If I have a project and I mark it as
<Assembly: CLSCompliant(True)>
Do I need to put CLSCompliant(True) before every class in the project, or are they all defaulted to CLSCompliant?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Adding the CLSCompliant attribute at the assembly level does not change the classes in anyway, so it does not make the classes CLS compliant. What it does is to force the compiler to raise anything that isn’t compliant as an error. It is still your responsibility to actually make sure the classes don’t break the rules.
That said though, yes it does filter down and affect all the classes in the assembly without the need to add it again to each class. From here:
This article is also a quite a nice overview on how it works, what you need to do, and why you may want to do it.