List or BusinessObjectCollection?

后端 未结 18 1195
庸人自扰
庸人自扰 2020-12-23 11:11

Prior to C# generics, everyone would code collections for their business objects by creating a collection base that implemented IEnumerable

IE:

publi         


        
18条回答
  •  猫巷女王i
    2020-12-23 11:29

    I would do this:

    using BusinessObjectCollection = List;
    

    This just creates an alias rather than a completely new type. I prefer it to using List directly because it leaves me free to change the underlying structure of the collection at some point in the future without changing code that uses it (as long as I provide the same properties and methods).

提交回复
热议问题