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:
无符号类型不应是类的公共接口的一部分.这意味着公共字段不应该有像uint
或ulong
这样的无符号类型,公共方法不应该返回无符号类型,传递给公共函数的参数不应该有无符号类型.但是,无符号类型可以是私有成员的一部分.
不安全类型(如pointers)不应与public
个成员一起使用.但是,它们可以与private
个成员一起使用.
类名和成员名不应仅根据大小写而有所不同.例如,我们不能有两个名为MyMethod
和MYMETHOD
的方法.
只能重载属性和方法,不应重载运算符.