What is the CLSCompliant
attribute?
You mark classes with the CLSCompliant
attribute 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 uint
or ulong
, 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 public
members. However they can be used with private
members.
Class names and member names should not differ only based on their case. For example we cannot have two methods named MyMethod
and MYMETHOD
.
Only properties and methods may be overloaded, operators should not be overloaded.