Recommendation 136: Prioritize using suffixes to indicate new versions of existing types
Adding suffixes in some cases is a very strange form, and we are unwilling to see a type like OrderProcessor2. However, it is still necessary to do so at some point. The most typical is the two types of x509certificate and X509Certificate2 in the FCL about digital certificate operations.
The X509Certificate type was first seen in the FCL 1.0/1.1 version, and later in the FCL2.0 version, a subsequent version: Type X509Certificate2. This subsequent version is not a subclass of a previous version, but instead appears as an alternative version.
Remember that when you have to have a new version of a type, you should add a suffix instead of a prefix. This is not just a habit problem, it also helps intelligence discover this new version of the class.
The new version of the improper naming method is as follows:
class sampleclass{ // omit }class sampleclassnew{ // omitted }
We might know from the name that SampleClass is a previous version, and Sampleclassnew is a new version, but it's hard to name a new version if it comes up again in the future.
The use of numbers as suffixes effectively avoids the occurrence of this condition. Subsequent versions of SampleClass can be named SampleClass2, SAMPLECLASS3, and so on.
Turn from: 157 recommendations for writing high-quality code to improve C # programs Minjia
"Go" writing high-quality Code 157 recommendations for improving C # programs--Recommendation 136: Prioritize using suffixes to represent new versions of existing types