C# Class naming convention: Is it BaseClass or ClassBase or AbstractClass

前端 未结 8 1135
时光取名叫无心
时光取名叫无心 2020-12-07 14:22

What is the recommended approach to naming base classes? Is it prefixing the type name with \"Base\" or \"Abstract\" or would we just suffi

8条回答
  •  误落风尘
    2020-12-07 14:53

    There are examples in the Framework with the Base suffix, e.g. System.Configuration.Provider.ProviderBase, System.Web.SessionState.SessionStateStoreProviderBase.

    But by no means all abstract base classes in the Framework follow this convention (e.g. System.Data.Common.DbParameter, System.Data.Common.DbCommand).

    Personally I would avoid using the suffix unless I wanted to emphasize the fact that it's an abstract class and felt that otherwise users of the class might expect the name to indicate a concrete implementation.

提交回复
热议问题