What is the CLSCompliant attribute?
Share
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.
You mark classes with the
CLSCompliantattribute when you want to make sure it can be used by any other .NET language.These are the basic rules:
Unsigned types should not be part of the public interface of the class. What this means is public fields should not have unsigned types like
uintorulong, public methods should not return unsigned types, parameters passed to public function should not have unsigned types. However unsigned types can be part of private members.Unsafe types like pointers should not be used with
publicmembers. However they can be used withprivatemembers.Class names and member names should not differ only based on their case. For example we cannot have two methods named
MyMethodandMYMETHOD.Only properties and methods may be overloaded, operators should not be overloaded.