C# abstract class naming convention [duplicate]
In C#, the interface naming convention is I<myInterfaceName>
(ex: IList
).
Are there any naming conventions for abstract classes?
If there aren't, what are the main recommendations?
Solution 1:
Normally, there is no suffix/prefix used when naming abstract classes, unlike interfaces, which have the prefix "I". Just give your class a name that describes what it is for, in a short precise way.
Solution 2:
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.
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.