锐单电子商城 , 一站式电子元器件采购平台!
  • 电话:400-990-0325

DesignRules(设计规则)

时间:2022-08-06 01:00:00 aeco传感器sia30

一、DesignRules(设计规则)

【01】、Abstract types should not have constructors(抽象类型不应具有结构函数)

【02】、Declare types in namespaces(声明命名空间中的类型)

【03】、Define accessors for attribute arguments(访问器定义属性参数)

【04】、Do not declare protected members in sealed types(密封类型中不得声明受保护成员)

【05】、DoNotDeclareVirtualMembersInSealedTypes(不要在密封类型中声明虚拟成员)

【06】、DoNotHideBaseClassMethods(不要隐藏基本方法)

【07】、DoNotOverloadOperatorEqualsOnReferenceTypes(不要对引用类型的重载等号操作符)

【08】、Exceptions should be public(异常应该是公共的)

【09】、Implement IDisposable correctly(正确实现IDisposable)

【10】、Implement standard exception constructors(实现标准异常结构函数)

【11】、IndexersShouldNotBeMultidimensional(索引器不应多维)

【12】、MarkAttributesWithAttributeUsage(用AttributeUsageAttribute标记属性)

【13】、Mark enums with FlagsAttribute(用FlagsAttribute标记枚举)

【14】、MembersShouldNotExposeCertainConcreteTypes(成员不应披露某些特定类型)

【15】、OverloadOperatorEqualsOnOverloadingAddAndSubtract(重载加运算符和减运算符应重载相等运算符)

【16】、PropertiesShouldNotBeWriteOnly(属性不应只写)

【17】、ProvideObsoleteAttributeMessage(提供ObsoleteAttribute消息)

【18】、ReplaceRepetitiveArgumentsWithParamsArray(用参数数组替换重复的变量)

【19】、Static holder types should be sealed(静态容器类型应密封)

【20】、Static holder types should not have constructors(静态容器类型不应具有结构函数)

【21】、StringUriOverloadsCallSystemUriOverloads(字符串URI重载调用System.Uri重载)

【22】、Types should not extend certain base types(某些基类型不应扩展类型)

【23】、Types that own disposable fields should be disposable(可释放字段的类型应该是可释放的)

【24】、Types that own native resources should be disposable(本机资源类型应可释放)

【25】、UriParametersShouldNotBeStrings(URI参数不应为字符串)

【26】、UriPropertiesShouldNotBeStrings(URI属性不应为字符串)

【27】、ValidateArgumentsOfPublicMethods(验证公共方法的参数)

二、Globalization Rules(全球化规则)

三、Interoperability Rules(互操作规则)

四、Naming Rules(命名规则)

【01】、EventsShouldNotHaveBeforeOrAfterPrefix(不应具备事件before或after前缀)

【02】、IdentifiersShouldDifferByMoreThanCase(标识符不应仅以大小写区分)

【03】、IdentifiersShouldHaveCorrectSuffix(标识符应有正确的后缀)

【04】、IdentifiersShouldNotHaveIncorrectPrefix(标识符应使用正确的前缀)

【05】、IdentifiersShouldNotHaveIncorrectSuffix(标识符应使用正确的后缀)

【06】、OnlyFlagsEnumsShouldHavePluralNames(只有FlagsAttribute枚举应以复数形式命名)

【07】、Parameter names should match base declaration(参数名应与基本方法中的声明一致)

【08】、Parameter names should not match member names(参数名不得与成员名冲突)

【09】、Type names should not match namespaces(类型名不应与命名空间冲突)

五、Performance Rules(性能规则)

【01】、AvoidExcessiveLocals(避免局部变量过多)

【02】、Avoid uncalled private code(避免使用未调用的私有代码)

【03】、Avoid unused private fields(避免未使用的私有字段)

【04】、Do not cast unnecessarily(避免不必要的强制转换)

【05】、Do not initialize unnecessarily(避免不必要的初始化)

【06】、Remove empty finalizers(取空终结器)

【07】、RemoveUnusedLocals(删除未使用的局部变量)

【08】、Test for empty strings using string length(使用字符串长度测试是否有空字符串)

六、Portability Rules(可移植性规则)

七、Security Rules(安全规则)

【01】、Array fields should not be read only(数组字段不应只读)

【02】、CatchNonClsCompliantExceptionsInGeneralHandlers(在常规处理程序中捕捉非CLSCompliant异常)

【03】、MethodSecurityShouldBeASupersetOfType(方法安全性应为类型安全性超集)

【04】、ReviewDeclarativeSecurityOnValueTypes(检查相关值类型的声明安全性)

【05】、ReviewVisibleEventHandlers(检查可见事件处理程序)

【06】、SealMethodsThatSatisfyPrivateInterfaces(私有接口密封法)

【07】、Secured types should not expose fields(受保护类型不得公开字段)

【08】、StaticConstructorsShouldBePrivate(静态构造函数为私有)

【09】、WrapVulnerableFinallyClausesInOuterTry(在外部try块中包装易受攻击finally子句)

八、Usage Rules(用法规则)

【01】、AttributeStringLiteralsShouldParseCorrectly(属性字符串文本应正确分析)

【02】、Call GC.SuppressFinalize correctly(正确调用GC.SuppressFinalize)

【03】、Collection properties should be read only(集合属性应只读)

【04】、Disposable fields should be disposed(应释放可释放的字段)

【05】、DisposableTypesShouldDeclareFinalizer(可释放类型应声明终结器)

【06】、Do not call overridable methods in constructors(不要在构造函数中调用可重写的方法)

【07】、DoNotDecreaseInheritedMemberVisibility(不降低继承人的可见性)

【08】、Do not ignore method results(不要忽视方法结果)

【09】、Do not mark enums with FlagsAttribute(不要使用FlagsAttribute标记枚举)

【10】、DoNotShipUnreleasedResourceFormats(未发布的资源格式不得发行)

【11】、FinalizersShouldBeProtectd(终结器应受到保护)

【12】、Finalizers should call base class finalizer(终结器应调用基类的终结器)

【13】、Initialize value type static fields inline(初始化内联值类型的静态字段)

【14】、MarkWindowsFormsEntryPointsWithStaThread(使用 STAThread 标记 Windows 窗体的入口点)

【15】、MembersShouldDifferByMoreThanReturnType(成员不应只是返回类型不同)

【16】、NonConstantFieldsShouldNotBeVisible(非常数字段不应该是可见的)

【17】、Operations should not overflow(运算不应溢出)

【18】、OperatorsShouldHaveSymmetricalOverloads(运算符应有对称重载)

【19】、PassSystemUriObjectsInsteadOfStrings(传递 System.Uri 对象而不是字符串)

【20】、TestForNaNCorrectly(正确测试 NaN)

锐单商城拥有海量元器件数据手册IC替代型号,打造电子元器件IC百科大全!

相关文章