This question already has an answer here:
这个问题在这里已有答案:
- Naming conventions for abstract classes 6 answers
- 抽象类的命名约定6答案
In C#, the interface naming convention is I<myInterfaceName>
(ex: IList
).
在C#中,接口命名约定是I
Are there any naming conventions for abstract classes?
是否有抽象类的命名约定?
If there aren't, what are the main recommendations?
如果没有,主要建议是什么?
2 个解决方案
#1
18
Normally there is no suffix/prefix used when naming abstract classes like it is for things like Interfaces (i.e. the "I" prefix). Just give your class a name that describes what it is for an a short precise way.
通常,在命名抽象类时没有使用后缀/前缀,就像接口这样的东西(即“I”前缀)。只需给你的班级一个名称,用一种简短的方式描述它是什么。
#2
9
Are there a naming convention for abstract class ?
是否有抽象类的命名约定?
No, there are no conventions here. There are some common ways of denoting an abstract base class. The most common I've seen is to use the suffix Base
. Personally, I do not like this convention, and the Framework guidelines recommend against it.
不,这里没有约定。有一些表示抽象基类的常用方法。我见过的最常见的是使用后缀Base。就个人而言,我不喜欢这个惯例,框架指南建议不要这样做。
And if there aren't what is the mains recommandations ?
如果没有什么是主电源推荐?
A good, general name that describes what the class is modeling, just like any other class name. So Shape
and then Polygon
and then RegularPolygon
so on.
一个很好的通用名称,描述类正在建模的内容,就像任何其他类名一样。那么Shape然后是Polygon然后是RegularPolygon等等。
#1
18
Normally there is no suffix/prefix used when naming abstract classes like it is for things like Interfaces (i.e. the "I" prefix). Just give your class a name that describes what it is for an a short precise way.
通常,在命名抽象类时没有使用后缀/前缀,就像接口这样的东西(即“I”前缀)。只需给你的班级一个名称,用一种简短的方式描述它是什么。
#2
9
Are there a naming convention for abstract class ?
是否有抽象类的命名约定?
No, there are no conventions here. There are some common ways of denoting an abstract base class. The most common I've seen is to use the suffix Base
. Personally, I do not like this convention, and the Framework guidelines recommend against it.
不,这里没有约定。有一些表示抽象基类的常用方法。我见过的最常见的是使用后缀Base。就个人而言,我不喜欢这个惯例,框架指南建议不要这样做。
And if there aren't what is the mains recommandations ?
如果没有什么是主电源推荐?
A good, general name that describes what the class is modeling, just like any other class name. So Shape
and then Polygon
and then RegularPolygon
so on.
一个很好的通用名称,描述类正在建模的内容,就像任何其他类名一样。那么Shape然后是Polygon然后是RegularPolygon等等。