General Types vs Abstract Class / Interfaces

Suppose we create a common control in .NET. For example. tree. I don’t understand why people use this general type definition.

Control<T>

when in object oriented programming I can use an abstract class or interface:

Control<IItem> or Control<BaseClass>

So, the only thing that needs to be done is that their types must be inferred from this base class or implement an interface. Does this mean that generic types are more convenient because you don't need to implement or inherit anything?

+5
source share
2 answers

, . / . / . API -, , .

, -, - , . . , . , , .

List, . List , , List .

+16

Tree , ( ).

, , (, IItem BaseClass).

Tree Tree , .

/abstractBase?
/ Item, . . Tree ...

+3

All Articles