What You’ll Learn in This Hour
You have already seen how an object can refer to an instance of any class. This enables you to create classes that operate on any data type. Several significant problems can occur with this approach. By working only with
object, there is no way for the class to restrict input to be only of a specific type. To perform meaningful operations on the data, it must be cast from
object to a more well-defined type. This not only adds complexity, but also sacrifices type safety at compile time.
Generics in C# solve this problem ...