C# abstract class naming convention

C#.NetNaming Conventions

C# Problem Overview


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?

C# Solutions


Solution 1 - C#

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 - C#

> 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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionbinardView Question on Stackoverflow
Solution 1 - C#bpoissView Answer on Stackoverflow
Solution 2 - C#jasonView Answer on Stackoverflow