How to name C# source files for generic classes

前端 未结 5 981
再見小時候
再見小時候 2020-12-01 13:57

I am trying to stick to general naming conventions such as those described in Design Guidelines for Developing Class Libraries. I put every type into its own source file (an

5条回答
  •  Happy的楠姐
    2020-12-01 14:28

    I add a suffix 'T' to the names of my generic classes.

    class Bag { }                           // in file Bag.cs 
    class BagT : Bag { }                 // in file BagT.cs
    class BagInputs : BagT           // in file BagInputs.cs
    

    You asked,

    Should I put the code of both the non-generic and the generic Bag classes into the same Bag.cs file? What are your habits?

    The above convention of mine is non-standard; I should clarify that I was answering "what are my habits" and not necessarily "what you should do".

提交回复
热议问题