Skip to content

代码规范+新语法糖 #4

Description

@lxymahatma

因为使用了C#12以及开启了nullable,可以使用很多新的语法糖比如 using statements 可以不用括号围起来而是用 ;,在方法结束会自动释放,前面写了类型后面new的时候不用加类型名称,collection expression (可以增加性能)等等

代码规范方面,不清楚是不是因为比较赶着做功能,很多都不太统一

  1. 缺少 private public 修饰符
  2. class 内的 private field 命名规范一般为下划线开头如 _index,方便与传入的参数做区分
  3. 类和方法命名不够准确,比如 Common 类应该命名为 CommonDirs
  4. C#的方法内变量可以用var来声明,也有很多人用(靠ide推断类型)详情看 这里
  5. 有些方法的xml注释只有一半

希望可以在项目添加 .editorconfig 或者告知代码规范,如果允许的话我可以根据以上内容等做一个pr

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions