c# collection inheritance

前端 未结 3 647
忘掉有多难
忘掉有多难 2021-01-14 23:53

Is there a collection in c# that supports the inheritance like concept that objects can have of appearing to include all the elements from another as well as themselves?

3条回答
  •  孤城傲影
    2021-01-15 00:23

    Let dogs and cats inherit from an interface, and create HashSet's of the interface instead of the classes. Or use a base class.

    for example:

    HashSet
    

提交回复
热议问题