【问题标题】:Should static classes have their first letter uppercased?静态类的首字母应该大写吗?
【发布时间】:2018-08-31 22:50:15
【问题描述】:

一般来说,(对于任何面向对象编程语言) 按照惯例,静态类的第一个字母应该大写吗?

例如,在:

// Example of a static class in JavaScript ES6

class myStaticClass {
  static toUppercaseOrNotToUppercase() {
    return Stackoverflow.ask('Should static classes like this conventionally have their first letter uppercased?');
  }
}

该类应该声明为myStaticClass 还是MyStaticClass

【问题讨论】:

    标签: conventions static-classes


    【解决方案1】:

    根据 Microsoft 和最佳实践,无论是静态还是非命名准则,类名都应采用 PascalCasing。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-29
      • 2011-05-14
      • 1970-01-01
      • 2011-06-16
      • 1970-01-01
      • 1970-01-01
      • 2021-11-02
      • 2019-12-04
      相关资源
      最近更新 更多